Skip to content

Commit 730b020

Browse files
Andreas Gruenbachergitster
authored andcommitted
fetch: Fix minor memory leak
A temporary struct ref is allocated in store_updated_refs() but not freed. Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8da61a2 commit 730b020

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

builtin-fetch.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
387387
fputc(url[i], fp);
388388
fputc('\n', fp);
389389

390-
if (ref)
390+
if (ref) {
391391
rc |= update_local_ref(ref, what, note);
392-
else
392+
free(ref);
393+
} else
393394
sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
394395
SUMMARY_WIDTH, *kind ? kind : "branch",
395396
REFCOL_WIDTH, *what ? what : "HEAD");

0 commit comments

Comments
 (0)