mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 12:11:25 +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)
|
#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead)
|
||||||
|
|
||||||
/* Free all memory associated with the given acttab */
|
/* 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->aAction );
|
||||||
free( p->aLookahead );
|
free( p->aLookahead );
|
||||||
free( p );
|
free( p );
|
||||||
|
@ -2506,12 +2507,14 @@ struct lemon *gp;
|
||||||
ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.",
|
ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.",
|
||||||
filesize+1);
|
filesize+1);
|
||||||
gp->errorcnt++;
|
gp->errorcnt++;
|
||||||
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( fread(filebuf,1,filesize,fp)!=filesize ){
|
if( fread(filebuf,1,filesize,fp)!=filesize ){
|
||||||
ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.",
|
ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.",
|
||||||
filesize);
|
filesize);
|
||||||
free(filebuf);
|
free(filebuf);
|
||||||
|
fclose(fp);
|
||||||
gp->errorcnt++;
|
gp->errorcnt++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3081,9 +3084,11 @@ struct lemon *lemp;
|
||||||
in = fopen(tpltname,"rb");
|
in = fopen(tpltname,"rb");
|
||||||
if( in==0 ){
|
if( in==0 ){
|
||||||
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
|
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
|
||||||
|
free(tpltname);
|
||||||
lemp->errorcnt++;
|
lemp->errorcnt++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
free(tpltname);
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3942,6 +3947,7 @@ int mhflag; /* Output in makeheaders format if true */
|
||||||
/* Append any addition code the user desires */
|
/* Append any addition code the user desires */
|
||||||
tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno);
|
tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno);
|
||||||
|
|
||||||
|
acttab_free(&pActtab);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue