List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 1/6] ui-blob: fix resource leak: free before return
@ 2015-10-10 14:56 list
  2015-10-10 14:56 ` [PATCH 2/6] " list
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: list @ 2015-10-10 14:56 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

Coverity-id: 13944
Signed-off-by: Christian Hesse <mail at eworm.de>
---
 ui-blob.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui-blob.c b/ui-blob.c
index d3c3a10..9824c90 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -170,4 +170,5 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
 	ctx.page.filename = path;
 	cgit_print_http_headers();
 	html_raw(buf, size);
+	free(buf);
 }
-- 
2.6.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/6] ui-blob: fix resource leak: free before return
  2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
@ 2015-10-10 14:56 ` list
  2015-10-10 19:38   ` Jason
  2015-10-10 14:56 ` [PATCH 3/6] ui-atom: fix resource leak: free allocation from cgit_repourl list
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: list @ 2015-10-10 14:56 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

Coverity-id: 13943
Signed-off-by: Christian Hesse <mail at eworm.de>
---
 ui-blob.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui-blob.c b/ui-blob.c
index 9824c90..1ded839 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -99,6 +99,7 @@ int cgit_print_file(char *path, const char *head, int file_only)
 		return -1;
 	buf[size] = '\0';
 	html_raw(buf, size);
+	free(buf);
 	return 0;
 }
 
-- 
2.6.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/6] ui-atom: fix resource leak: free allocation from cgit_repourl
  2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
  2015-10-10 14:56 ` [PATCH 2/6] " list
@ 2015-10-10 14:56 ` list
  2015-10-10 14:56 ` [PATCH 4/6] ui-atom: fix resource leak: free before return list
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: list @ 2015-10-10 14:56 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

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

diff --git a/ui-atom.c b/ui-atom.c
index e2b39ee..d7138fb 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -125,11 +125,13 @@ void cgit_print_atom(char *tip, char *path, int max_count)
 	html_txt(ctx.repo->desc);
 	html("</subtitle>\n");
 	if (host) {
+		char *repourl = cgit_repourl(ctx.repo->url);
 		html("<link rel='alternate' type='text/html' href='");
 		html(cgit_httpscheme());
 		html_attr(host);
-		html_attr(cgit_repourl(ctx.repo->url));
+		html_attr(repourl);
 		html("'/>\n");
+		free(repourl);
 	}
 	while ((commit = get_revision(&rev)) != NULL) {
 		add_entry(commit, host);
-- 
2.6.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/6] ui-atom: fix resource leak: free before return
  2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
  2015-10-10 14:56 ` [PATCH 2/6] " list
  2015-10-10 14:56 ` [PATCH 3/6] ui-atom: fix resource leak: free allocation from cgit_repourl list
@ 2015-10-10 14:56 ` list
  2015-10-10 19:40   ` Jason
  2015-10-10 14:56 ` [PATCH 5/6] ui-atom: fix resource leak: free allocation from cgit_pageurl list
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: list @ 2015-10-10 14:56 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/6] ui-atom: fix resource leak: free allocation from cgit_pageurl
  2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
                   ` (2 preceding siblings ...)
  2015-10-10 14:56 ` [PATCH 4/6] ui-atom: fix resource leak: free before return list
@ 2015-10-10 14:56 ` list
  2015-10-10 19:40   ` Jason
  2015-10-10 14:56 ` [PATCH 6/6] cache: fix resource leak: close file handle before return list
  2015-10-10 19:39 ` [PATCH 1/6] ui-blob: fix resource leak: free " Jason
  5 siblings, 1 reply; 11+ messages in thread
From: list @ 2015-10-10 14:56 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

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

diff --git a/ui-atom.c b/ui-atom.c
index fab4b0f..e186299 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -53,14 +53,17 @@ static void add_entry(struct commit *commit, const char *host)
 	cgit_print_date(info->author_date, FMT_ATOMDATE, 0);
 	html("</published>\n");
 	if (host) {
+		char *pageurl;
 		html("<link rel='alternate' type='text/html' href='");
 		html(cgit_httpscheme());
 		html_attr(host);
-		html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL));
+		pageurl = cgit_pageurl(ctx.repo->url, "commit", NULL);
+		html_attr(pageurl);
 		if (ctx.cfg.virtual_root)
 			delim = '?';
 		htmlf("%cid=%s", delim, hex);
 		html("'/>\n");
+		free(pageurl);
 	}
 	htmlf("<id>%s</id>\n", hex);
 	html("<content type='text'>\n");
-- 
2.6.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/6] cache: fix resource leak: close file handle before return
  2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
                   ` (3 preceding siblings ...)
  2015-10-10 14:56 ` [PATCH 5/6] ui-atom: fix resource leak: free allocation from cgit_pageurl list
@ 2015-10-10 14:56 ` list
  2015-10-10 19:41   ` Jason
  2015-10-10 19:39 ` [PATCH 1/6] ui-blob: fix resource leak: free " Jason
  5 siblings, 1 reply; 11+ messages in thread
From: list @ 2015-10-10 14:56 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

Coverity-id: 13910
Signed-off-by: Christian Hesse <mail at eworm.de>
---
 cache.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/cache.c b/cache.c
index 57c8918..b169d20 100644
--- a/cache.c
+++ b/cache.c
@@ -215,19 +215,25 @@ static int fill_slot(struct cache_slot *slot)
 		return errno;
 
 	/* Redirect stdout to lockfile */
-	if (dup2(slot->lock_fd, STDOUT_FILENO) == -1)
+	if (dup2(slot->lock_fd, STDOUT_FILENO) == -1) {
+		close(tmp);
 		return errno;
+	}
 
 	/* Generate cache content */
 	slot->fn();
 
 	/* update stat info */
-	if (fstat(slot->lock_fd, &slot->cache_st))
+	if (fstat(slot->lock_fd, &slot->cache_st)) {
+		close(tmp);
 		return errno;
+	}
 
 	/* Restore stdout */
-	if (dup2(tmp, STDOUT_FILENO) == -1)
+	if (dup2(tmp, STDOUT_FILENO) == -1) {
+		close(tmp);
 		return errno;
+	}
 
 	/* Close the temporary filedescriptor */
 	if (close(tmp))
-- 
2.6.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/6] ui-blob: fix resource leak: free before return
  2015-10-10 14:56 ` [PATCH 2/6] " list
@ 2015-10-10 19:38   ` Jason
  0 siblings, 0 replies; 11+ messages in thread
From: Jason @ 2015-10-10 19:38 UTC (permalink / raw)


Merged, thanks.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] ui-blob: fix resource leak: free before return
  2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
                   ` (4 preceding siblings ...)
  2015-10-10 14:56 ` [PATCH 6/6] cache: fix resource leak: close file handle before return list
@ 2015-10-10 19:39 ` Jason
  5 siblings, 0 replies; 11+ messages in thread
From: Jason @ 2015-10-10 19:39 UTC (permalink / raw)


Merged.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/6] ui-atom: fix resource leak: free before return
  2015-10-10 14:56 ` [PATCH 4/6] ui-atom: fix resource leak: free before return list
@ 2015-10-10 19:40   ` Jason
  0 siblings, 0 replies; 11+ messages in thread
From: Jason @ 2015-10-10 19:40 UTC (permalink / raw)


Merged.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/6] ui-atom: fix resource leak: free allocation from cgit_pageurl
  2015-10-10 14:56 ` [PATCH 5/6] ui-atom: fix resource leak: free allocation from cgit_pageurl list
@ 2015-10-10 19:40   ` Jason
  0 siblings, 0 replies; 11+ messages in thread
From: Jason @ 2015-10-10 19:40 UTC (permalink / raw)


Merged.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/6] cache: fix resource leak: close file handle before return
  2015-10-10 14:56 ` [PATCH 6/6] cache: fix resource leak: close file handle before return list
@ 2015-10-10 19:41   ` Jason
  0 siblings, 0 replies; 11+ messages in thread
From: Jason @ 2015-10-10 19:41 UTC (permalink / raw)


Merged.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-10-10 19:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-10 14:56 [PATCH 1/6] ui-blob: fix resource leak: free before return list
2015-10-10 14:56 ` [PATCH 2/6] " list
2015-10-10 19:38   ` Jason
2015-10-10 14:56 ` [PATCH 3/6] ui-atom: fix resource leak: free allocation from cgit_repourl list
2015-10-10 14:56 ` [PATCH 4/6] ui-atom: fix resource leak: free before return list
2015-10-10 19:40   ` Jason
2015-10-10 14:56 ` [PATCH 5/6] ui-atom: fix resource leak: free allocation from cgit_pageurl list
2015-10-10 19:40   ` Jason
2015-10-10 14:56 ` [PATCH 6/6] cache: fix resource leak: close file handle before return list
2015-10-10 19:41   ` Jason
2015-10-10 19:39 ` [PATCH 1/6] ui-blob: fix resource leak: free " Jason

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).