[PATCH] fetch: plug two leaks on error exit in store_updated_refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Close FETCH_HEAD and release the string url even if we have to leave the
function store_updated_refs() early.

Reported-by: Chris Wilson <cwilson@xxxxxxxxxxxxxx>
Signed-off-by: Rene Scharfe <rene.scharfe@xxxxxxxxxxxxxx>
---
 builtin/fetch.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 7a4e41c..79db796 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -379,8 +379,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 		url = xstrdup("foreign");
 
 	rm = ref_map;
-	if (check_everything_connected(iterate_ref_map, 0, &rm))
-		return error(_("%s did not send all necessary objects\n"), url);
+	if (check_everything_connected(iterate_ref_map, 0, &rm)) {
+		error(_("%s did not send all necessary objects\n"), url);
+		free(url);
+		fclose(fp);
+		return -1;
+	}
 
 	for (rm = ref_map; rm; rm = rm->next) {
 		struct ref *ref = NULL;
-- 
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]