cgit

commit 08a2b818f2bd3221a1685c28c62408d57b0993a7

Author: Christian Hesse <mail@eworm.de>

ui-plain: fix resource leak: free before assigning NULL

Coverity-id: 13939
Signed-off-by: Christian Hesse <mail@eworm.de>

 ui-plain.c | 4 +++-


diff --git a/ui-plain.c b/ui-plain.c
index 4c736072287460a55c7abd83f29bd09ebb00fc0d..e4beb997c371a6608e425519fff61c8ef19a3f87 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -84,8 +84,10 @@ 		fullpath[len - 1] = 0;
 		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);