[PATCH 4/4] ui-plain: fix resource leak: free before assigning NULL
Christian Hesse
list at eworm.de
Fri Oct 9 14:55:50 CEST 2015
From: Christian Hesse <mail at eworm.de>
Coverity-id: 13939
Signed-off-by: Christian Hesse <mail at eworm.de>
---
ui-plain.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
2.6.1
More information about the CGit
mailing list