about summary refs log tree commit
path: root/ui-plain.c
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2015-10-09 14:55:50 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2015-10-09 15:50:34 +0200
commit08a2b818f2bd3221a1685c28c62408d57b0993a7 (patch)
tree412c1cd43932ac44ff03f932cbe7c61c39835a4d /ui-plain.c
parent979db79a80f1926c677691b68eb22b4852a77b50 (diff)
downloadcgit-08a2b818f2bd3221a1685c28c62408d57b0993a7.tar.gz
ui-plain: fix resource leak: free before assigning NULL
Coverity-id: 13939
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'ui-plain.c')
-rw-r--r--ui-plain.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui-plain.c b/ui-plain.c
index 4c73607..e4beb99 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -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);