Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/patch Plug a memory leak. From Igor Zinovik.



details:   https://anonhg.NetBSD.org/src/rev/041080240577
branches:  trunk
changeset: 750661:041080240577
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Jan 10 01:10:16 2010 +0000

description:
Plug a memory leak. From Igor Zinovik.

diffstat:

 usr.bin/patch/util.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 2e8f5d812215 -r 041080240577 usr.bin/patch/util.c
--- a/usr.bin/patch/util.c      Sat Jan 09 22:54:00 2010 +0000
+++ b/usr.bin/patch/util.c      Sun Jan 10 01:10:16 2010 +0000
@@ -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)



Home | Main Index | Thread Index | Old Index