connected.c: free the "struct packed_git"
The "new_pack" we allocate in check_connected() wasn't being
free'd. Let's do that before we return from the function. This has
leaked ever since "new_pack" was added to this function in
c6807a40dc
(clone: open a shortcut for connectivity check,
2013-05-26).
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f1f4ebf432
commit
dd4143e7bf
@ -85,6 +85,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
|
||||
promisor_pack_found:
|
||||
;
|
||||
} while ((oid = fn(cb_data)) != NULL);
|
||||
free(new_pack);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -118,8 +119,10 @@ no_promisor_pack_found:
|
||||
else
|
||||
rev_list.no_stderr = opt->quiet;
|
||||
|
||||
if (start_command(&rev_list))
|
||||
if (start_command(&rev_list)) {
|
||||
free(new_pack);
|
||||
return error(_("Could not run 'git rev-list'"));
|
||||
}
|
||||
|
||||
sigchain_push(SIGPIPE, SIG_IGN);
|
||||
|
||||
@ -151,5 +154,6 @@ no_promisor_pack_found:
|
||||
err = error_errno(_("failed to close rev-list's stdin"));
|
||||
|
||||
sigchain_pop(SIGPIPE);
|
||||
free(new_pack);
|
||||
return finish_command(&rev_list) || err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user