Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make CondDoExists: Avoid use after free()



details:   https://anonhg.NetBSD.org/src/rev/992604c91465
branches:  trunk
changeset: 763643:992604c91465
user:      sjg <sjg%NetBSD.org@localhost>
date:      Tue Mar 29 17:19:22 2011 +0000

description:
CondDoExists: Avoid use after free()

diffstat:

 usr.bin/make/cond.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r 882359402218 -r 992604c91465 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Tue Mar 29 16:03:32 2011 +0000
+++ b/usr.bin/make/cond.c       Tue Mar 29 17:19:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.61 2011/02/13 21:24:42 sjg Exp $    */
+/*     $NetBSD: cond.c,v 1.62 2011/03/29 17:19:22 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.61 2011/02/13 21:24:42 sjg Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.62 2011/03/29 17:19:22 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.61 2011/02/13 21:24:42 sjg Exp $");
+__RCSID("$NetBSD: cond.c,v 1.62 2011/03/29 17:19:22 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -401,16 +401,16 @@
     char    *path;
 
     path = Dir_FindFile(arg, dirSearchPath);
+    if (DEBUG(COND)) {
+       fprintf(debug_file, "exists(%s) result is \"%s\"\n",
+              arg, path ? path : "");
+    }    
     if (path != NULL) {
        result = TRUE;
        free(path);
     } else {
        result = FALSE;
     }
-    if (DEBUG(COND)) {
-       fprintf(debug_file, "exists(%s) result is \"%s\"\n",
-              arg, path ? path : "");
-    }    
     return (result);
 }
 



Home | Main Index | Thread Index | Old Index