List for cgit developers and users
 help / color / mirror / Atom feed
From: list at eworm.de (Christian Hesse)
Subject: [PATCH 2/4] ui-repolist: fix resource leak: free allocation from cgit_currenturl
Date: Fri,  9 Oct 2015 14:55:48 +0200	[thread overview]
Message-ID: <1444395350-18204-2-git-send-email-list@eworm.de> (raw)
In-Reply-To: <1444395350-18204-1-git-send-email-list@eworm.de>

From: Christian Hesse <mail at eworm.de>

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

diff --git a/ui-repolist.c b/ui-repolist.c
index 4f52e0f..a2e9e07 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -108,14 +108,16 @@ static int is_in_url(struct cgit_repo *repo)
 
 static void print_sort_header(const char *title, const char *sort)
 {
+	char *currenturl = cgit_currenturl();
 	html("<th class='left'><a href='");
-	html_attr(cgit_currenturl());
+	html_attr(currenturl);
 	htmlf("?s=%s", sort);
 	if (ctx.qry.search) {
 		html("&amp;q=");
 		html_url_arg(ctx.qry.search);
 	}
 	htmlf("'>%s</a></th>", title);
+	free(currenturl);
 }
 
 static void print_header(void)
-- 
2.6.1



  reply	other threads:[~2015-10-09 12:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 12:55 [PATCH 1/4] ui-repolist: fix resource leak: free before return list
2015-10-09 12:55 ` list [this message]
2015-10-09 12:55 ` [PATCH 3/4] ui-plain: " list
2015-10-09 13:50   ` Jason
2015-10-09 12:55 ` [PATCH 4/4] ui-plain: fix resource leak: free before assigning NULL list
2015-10-09 13:49 ` [PATCH 1/4] ui-repolist: fix resource leak: free before return Jason

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=1444395350-18204-2-git-send-email-list@eworm.de \
    --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).