Author: John Keeping <john@keeping.me.uk>
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>
ui-tag.c | 6 ++++--
diff --git a/ui-tag.c b/ui-tag.c index 6b838cb7b238cd66308a78fb090f096389cd1e30..3fa63b3e760d3d5ba63e5a381a30e5fed1f491ea 100644 --- a/ui-tag.c +++ b/ui-tag.c @@ -44,8 +44,6 @@ { 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 @@ "Bad object id: %s", sha1_to_hex(sha1)); 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 @@ print_download_links(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");