From 730b02003070400a82ff89b240573765d71e839a Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Mon, 15 Mar 2010 23:18:48 +0100 Subject: [PATCH] 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 --- builtin-fetch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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"); -- 2.30.2