Module Name:    src
Committed By:   joerg
Date:           Sun Jan 10 01:10:16 UTC 2010

Modified Files:
        src/usr.bin/patch: util.c

Log Message:
Plug a memory leak. From Igor Zinovik.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/patch/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/util.c
diff -u src/usr.bin/patch/util.c:1.24 src/usr.bin/patch/util.c:1.25
--- src/usr.bin/patch/util.c:1.24	Fri Sep 19 18:33:34 2008
+++ src/usr.bin/patch/util.c	Sun Jan 10 01:10:16 2010
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: util.c,v 1.32 2006/03/11 19:41:30 otto Exp $
  * $DragonFly: src/usr.bin/patch/util.c,v 1.9 2007/09/29 23:11:10 swildner Exp $
- * $NetBSD: util.c,v 1.24 2008/09/19 18:33:34 joerg Exp $
+ * $NetBSD: util.c,v 1.25 2010/01/10 01:10:16 joerg Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: util.c,v 1.24 2008/09/19 18:33:34 joerg Exp $");
+__RCSID("$NetBSD: util.c,v 1.25 2010/01/10 01:10:16 joerg Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -326,8 +326,10 @@
 
 	if (striplast) {
 		char	*s = strrchr(tmpbuf, '/');
-		if (s == NULL)
+		if (s == NULL) {
+			free(tmpbuf);
 			return;	/* nothing to be done */
+		}
 		*s = '\0';
 	}
 	if (mkpath(tmpbuf) != 0)

Reply via email to