mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
- Plug some lemon leaks during xlat generation.
Found with Address Sanitizer.
This commit is contained in:
parent
50a3f8a3d2
commit
24a096fb27
1 changed files with 7 additions and 1 deletions
|
@ -437,7 +437,8 @@ struct acttab {
|
|||
#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead)
|
||||
|
||||
/* Free all memory associated with the given acttab */
|
||||
void acttab_free(acttab *p){
|
||||
void acttab_free(acttab **pp){
|
||||
acttab *p = *pp;
|
||||
free( p->aAction );
|
||||
free( p->aLookahead );
|
||||
free( p );
|
||||
|
@ -2506,12 +2507,14 @@ struct lemon *gp;
|
|||
ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.",
|
||||
filesize+1);
|
||||
gp->errorcnt++;
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
if( fread(filebuf,1,filesize,fp)!=filesize ){
|
||||
ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.",
|
||||
filesize);
|
||||
free(filebuf);
|
||||
fclose(fp);
|
||||
gp->errorcnt++;
|
||||
return;
|
||||
}
|
||||
|
@ -3081,9 +3084,11 @@ struct lemon *lemp;
|
|||
in = fopen(tpltname,"rb");
|
||||
if( in==0 ){
|
||||
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
|
||||
free(tpltname);
|
||||
lemp->errorcnt++;
|
||||
return 0;
|
||||
}
|
||||
free(tpltname);
|
||||
return in;
|
||||
}
|
||||
|
||||
|
@ -3942,6 +3947,7 @@ int mhflag; /* Output in makeheaders format if true */
|
|||
/* Append any addition code the user desires */
|
||||
tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno);
|
||||
|
||||
acttab_free(&pActtab);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue