mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-23 20:42:24 +00:00
- Fixed lemon trying to free non-allocated memory.
This is a regression from commit 24a096fb27
. It happened only the input files were present in the same directory as the executable.
This commit is contained in:
parent
964ee6bb23
commit
18de376edf
1 changed files with 6 additions and 2 deletions
|
@ -3061,6 +3061,7 @@ struct lemon *lemp;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
char *tpltname;
|
char *tpltname;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
Boolean tpltnameinbuf;
|
||||||
|
|
||||||
cp = strrchr(lemp->filename,'.');
|
cp = strrchr(lemp->filename,'.');
|
||||||
if( cp ){
|
if( cp ){
|
||||||
|
@ -3070,10 +3071,13 @@ struct lemon *lemp;
|
||||||
}
|
}
|
||||||
if( access(buf,004)==0 ){
|
if( access(buf,004)==0 ){
|
||||||
tpltname = buf;
|
tpltname = buf;
|
||||||
|
tpltnameinbuf = LEMON_TRUE;
|
||||||
}else if( access(templatename,004)==0 ){
|
}else if( access(templatename,004)==0 ){
|
||||||
tpltname = templatename;
|
tpltname = templatename;
|
||||||
|
tpltnameinbuf = LEMON_TRUE;
|
||||||
}else{
|
}else{
|
||||||
tpltname = pathsearch(lemp->argv0,templatename,0);
|
tpltname = pathsearch(lemp->argv0,templatename,0);
|
||||||
|
tpltnameinbuf = LEMON_FALSE;
|
||||||
}
|
}
|
||||||
if( tpltname==0 ){
|
if( tpltname==0 ){
|
||||||
fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
|
fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
|
||||||
|
@ -3084,11 +3088,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);
|
if (tpltnameinbuf == LEMON_FALSE) free(tpltname);
|
||||||
lemp->errorcnt++;
|
lemp->errorcnt++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
free(tpltname);
|
if (tpltnameinbuf == LEMON_FALSE) free(tpltname);
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue