Index: tool/lemon.c ================================================================== --- tool/lemon.c +++ tool/lemon.c @@ -2520,17 +2520,19 @@ filebuf = (char *)malloc( filesize+1 ); if( filebuf==0 ){ 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); gp->errorcnt++; + fclose(fp); return; } fclose(fp); filebuf[filesize] = 0;