summaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2010-01-10 01:10:16 +0000
committerjoerg <joerg@NetBSD.org>2010-01-10 01:10:16 +0000
commit06c042e9bc9ce5079c2e90eff7e8b91a518edf10 (patch)
tree2a49a28cf54a475840cf34fedbe44f519766714d /usr.bin/patch
parent8ab319847f48bfbaad53d090705347a772b02103 (diff)
Plug a memory leak. From Igor Zinovik.
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index bc5b2607a7a..0ae5a47dc17 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -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 @@ makedirs(const char *filename, bool striplast)
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)