about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2016-08-13 11:53:24 +0100
committerJohn Keeping <john@keeping.me.uk>2016-10-01 11:46:55 +0100
commitf80b73fa20d5c884114b971a20e1b4bb847e054e (patch)
tree1b71bedaef26cc193cbeb64bd2f80b5ea64c8cee
parentshared: make cgit_free_taginfo() public (diff)
downloadcgit-pink-f80b73fa20d5c884114b971a20e1b4bb847e054e.tar.gz
cgit-pink-f80b73fa20d5c884114b971a20e1b4bb847e054e.zip
ui-tag: clean up taginfo
Free the taginfo when we're done with it.  Also reduce the scope of a
couple of variables so that it's clear that this is the only path that
uses the taginfo structure.

Coverity-Id: 141883
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to '')
-rw-r--r--ui-tag.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui-tag.c b/ui-tag.c
index 6b838cb..3fa63b3 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -44,8 +44,6 @@ void cgit_print_tag(char *revname)
 	struct strbuf fullref = STRBUF_INIT;
 	unsigned char sha1[20];
 	struct object *obj;
-	struct tag *tag;
-	struct taginfo *info;
 
 	if (!revname)
 		revname = ctx.qry.head;
@@ -63,6 +61,9 @@ void cgit_print_tag(char *revname)
 		goto cleanup;
 	}
 	if (obj->type == OBJ_TAG) {
+		struct tag *tag;
+		struct taginfo *info;
+
 		tag = lookup_tag(sha1);
 		if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
 			cgit_print_error_page(500, "Internal server error",
@@ -99,6 +100,7 @@ void cgit_print_tag(char *revname)
 		html("</table>\n");
 		print_tag_content(info->msg);
 		cgit_print_layout_end();
+		cgit_free_taginfo(info);
 	} else {
 		cgit_print_layout_start();
 		html("<table class='commit-info'>\n");