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>
Andreas Gruenbacher committed
Mar 15, 2010 at 23:18 UTC
730b02003070400a82ff89b240573765d71e839a
1 file changed
+3
-2
builtin-fetch.c
+3
-2
@@ -387,9 +387,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
387
fputc(url[i], fp);
388
fputc('\n', fp);
389
390
- if (ref)
390
+ if (ref) {
391
rc |= update_local_ref(ref, what, note);
392
- else
392
+ free(ref);
393
+ } else
394
sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
395
SUMMARY_WIDTH, *kind ? kind : "branch",
396
REFCOL_WIDTH, *what ? what : "HEAD");