summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-10-17 21:37:12 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-17 21:37:12 -0700
commit3f7d11c45421051a010690c3b9cc28bce98b8c3f (patch)
treebc0f502dc3294dbbb356633be725d6d534f254b2 /builtin
parentMerge branch 'jk/name-hash-dirent' (diff)
parentfetch: plug two leaks on error exit in store_updated_refs (diff)
downloadtgif-3f7d11c45421051a010690c3b9cc28bce98b8c3f.tar.xz
Merge branch 'tc/fetch-leak'
* tc/fetch-leak: fetch: plug two leaks on error exit in store_updated_refs Conflicts: builtin/fetch.c
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fetch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 7a4e41cca7..1adf6c176f 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -379,8 +379,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
url = xstrdup("foreign");
rm = ref_map;
- if (check_everything_connected(iterate_ref_map, 0, &rm))
- return error(_("%s did not send all necessary objects\n"), url);
+ if (check_everything_connected(iterate_ref_map, 0, &rm)) {
+ rc = error(_("%s did not send all necessary objects\n"), url);
+ goto abort;
+ }
for (rm = ref_map; rm; rm = rm->next) {
struct ref *ref = NULL;
@@ -462,12 +464,15 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
fprintf(stderr, " %s\n", note);
}
}
- free(url);
- fclose(fp);
+
if (rc & STORE_REF_ERROR_DF_CONFLICT)
error(_("some local refs could not be updated; try running\n"
" 'git remote prune %s' to remove any old, conflicting "
"branches"), remote_name);
+
+ abort:
+ free(url);
+ fclose(fp);
return rc;
}