]> granicus.if.org Git - cgit/commitdiff
ui-plain: fix resource leak: free before assigning NULL
authorChristian Hesse <mail@eworm.de>
Fri, 9 Oct 2015 12:55:50 +0000 (14:55 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 9 Oct 2015 13:50:34 +0000 (15:50 +0200)
Coverity-id: 13939
Signed-off-by: Christian Hesse <mail@eworm.de>
ui-plain.c

index 4c736072287460a55c7abd83f29bd09ebb00fc0d..e4beb997c371a6608e425519fff61c8ef19a3f87 100644 (file)
@@ -84,8 +84,10 @@ static void print_dir(const unsigned char *sha1, const char *base,
                slash = strrchr(fullpath, '/');
                if (slash)
                        *(slash + 1) = 0;
-               else
+               else {
+                       free(fullpath);
                        fullpath = NULL;
+               }
                html("<li>");
                cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
                                fullpath);