Skip to content

Commit

Permalink
Merge branch 'tc/fetch-leak'
Browse files Browse the repository at this point in the history
* tc/fetch-leak:
  fetch: plug two leaks on error exit in store_updated_refs

Conflicts:
	builtin/fetch.c
  • Loading branch information
Junio C Hamano committed Oct 18, 2011
2 parents 6f55f02 + 9516a59 commit 3f7d11c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 3f7d11c

Please sign in to comment.