]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-plain.c
ui-plain: fix resource leak: free before assigning NULL
[ps-cgit] / 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);