summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-fetch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 8dd1adf..bbc425b 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");