lemon: add free() to avoid mem leak (CID 1309088)
authorDario Lombardo <lomato@gmail.com>
Mon, 5 Oct 2015 09:55:09 +0000 (11:55 +0200)
committerMichael Mann <mmann78@netscape.net>
Sat, 24 Oct 2015 16:48:09 +0000 (16:48 +0000)
Change-Id: Id32864d324f72ffee9c1033f0f36a79eb2651334
Reviewed-on: https://code.wireshark.org/review/10797
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
tools/lemon/lemon.c

index 7666530373edf0a378101a1269a1ade42310b7d8..573d6774fbb57c60aea3b2e80a728670bdedadb2 100644 (file)
@@ -2707,9 +2707,10 @@ void Parse(struct lemon *gp)
   filesize = ftell(fp);
   rewind(fp);
   filebuf = (char *)malloc( filesize+1 );
-  if( filesize>100000000 || filebuf==0 ){
+  if( filesize>100000000 || filebuf==NULL ){
     ErrorMsg(ps.filename,0,"Input file too large.");
     gp->errorcnt++;
+    free(filebuf);
     fclose(fp);
     return;
   }