[PATCH 4/6] ui-atom: fix resource leak: free before return

Christian Hesse list at eworm.de
Sat Oct 10 16:56:26 CEST 2015


From: Christian Hesse <mail at eworm.de>

Coverity-id: 13946
Signed-off-by: Christian Hesse <mail at eworm.de>
---
 ui-atom.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui-atom.c b/ui-atom.c
index d7138fb..fab4b0f 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -80,7 +80,7 @@ static void add_entry(struct commit *commit, const char *host)
 
 void cgit_print_atom(char *tip, char *path, int max_count)
 {
-	const char *host;
+	char *host;
 	const char *argv[] = {NULL, tip, NULL, NULL, NULL};
 	struct commit *commit;
 	struct rev_info rev;
@@ -140,4 +140,5 @@ void cgit_print_atom(char *tip, char *path, int max_count)
 		commit->parents = NULL;
 	}
 	html("</feed>\n");
+	free(host);
 }
-- 
2.6.1



More information about the CGit mailing list