List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 3/4] ui-tag: clean up taginfo
Date: Sat, 13 Aug 2016 12:04:31 +0100	[thread overview]
Message-ID: <eab3c4d19db231fd0fa83c537f89c61d07735ac0.1471085819.git.john@keeping.me.uk> (raw)
In-Reply-To: <057c333e857a0fb1583cbeb68906df3ac80e18c4.1471085819.git.john@keeping.me.uk>

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 at keeping.me.uk>
---
 ui-tag.c | 6 ++++--
 1 file 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");
-- 
2.9.2.639.g855ae9f



  parent reply	other threads:[~2016-08-13 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-13 11:04 [PATCH 1/4] shared: remove return value from cgit_free_commitinfo() john
2016-08-13 11:04 ` [PATCH 2/4] shared: make cgit_free_taginfo() public john
2016-08-13 11:04 ` john [this message]
2016-08-13 11:04 ` [PATCH 4/4] ui-tree: remove a fixed size buffer john

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eab3c4d19db231fd0fa83c537f89c61d07735ac0.1471085819.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).