summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-03-15 22:18:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-20 16:28:48 (GMT)
commit730b02003070400a82ff89b240573765d71e839a (patch)
tree68dd7258ae05dd980ef0d192a307046d7e0f3a6f
parent8da61a2ab48175526390233c8bcedf63a3cdb6c4 (diff)
downloadgit-730b02003070400a82ff89b240573765d71e839a.zip
git-730b02003070400a82ff89b240573765d71e839a.tar.gz
git-730b02003070400a82ff89b240573765d71e839a.tar.bz2
fetch: Fix minor memory leak
A temporary struct ref is allocated in store_updated_refs() but not freed. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-fetch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 8dd1adf..bbc425b 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -387,9 +387,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
fputc(url[i], fp);
fputc('\n', fp);
- if (ref)
+ if (ref) {
rc |= update_local_ref(ref, what, note);
- else
+ free(ref);
+ } else
sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
SUMMARY_WIDTH, *kind ? kind : "branch",
REFCOL_WIDTH, *what ? what : "HEAD");