From: Andreas Gruenbacher Date: Mon, 15 Mar 2010 22:18:48 +0000 (+0100) Subject: fetch: Fix minor memory leak X-Git-Tag: v1.7.0.3~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=730b02003070400a82ff89b240573765d71e839a;p=git.git fetch: Fix minor memory leak A temporary struct ref is allocated in store_updated_refs() but not freed. Signed-off-by: Andreas Gruenbacher Signed-off-by: Junio C Hamano --- diff --git a/builtin-fetch.c b/builtin-fetch.c index 8dd1adf84..bbc425b65 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");