PERFORCE change 168625 for review

Gabor Kovesdan gabor at FreeBSD.org
Thu Sep 17 16:30:18 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=168625

Change 168625 by gabor at gabor_aspire on 2009/09/17 16:29:24

	- Fix binary checking by eliminating an early free()

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/file.c#47 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#86 edit

Differences ...

==== //depot/projects/soc2008/gabor_textproc/grep/file.c#47 (text+ko) ====

@@ -243,7 +243,6 @@
 		BZ2_bzclose(f->bzf);
 		break;
 	}
-	free(f);
 
 	/* Reset read buffer for the file we are closing */
 	binbufptr = NULL;

==== //depot/projects/soc2008/gabor_textproc/grep/util.c#86 (text+ko) ====

@@ -196,6 +196,7 @@
 		/* Return if we need to skip a binary file */
 		if (f->binary && binbehave == BINFILE_SKIP) {
 			grep_close(f);
+			free(f);
 			return (0);
 		}
 		/* Process the file line-by-line */
@@ -229,6 +230,7 @@
 	    binbehave == BINFILE_BIN && f->binary && !qflag)
 		printf(getstr(9), fn);
 
+	free(f);
 	return (c);
 }
 


More information about the p4-projects mailing list