patch: Free temporary buffer after stripping.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Fri, 30 Apr 2010 07:56:48 +0000 (00:56 -0700)
committerSascha Wildner <saw@online.de>
Fri, 14 May 2010 00:18:24 +0000 (02:18 +0200)
Imported from OpenBSD 2010/01.

usr.bin/patch/util.c

index 23f0bcf..910692d 100644 (file)
@@ -322,8 +322,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)