Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2009 16:30:18 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 168625 for review
Message-ID:  <200909171630.n8HGUIAt007036@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=168625

Change 168625 by gabor@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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909171630.n8HGUIAt007036>