Skip to content

Commit

Permalink
fetch: Fix minor memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andreas Gruenbacher authored and Junio C Hamano committed Mar 20, 2010
1 parent 8da61a2 commit 730b020
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builtin-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 730b020

Please sign in to comment.