Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-10-28 23:27:54 +0300
committerJunio C Hamano <gitster@pobox.com>2014-10-29 00:55:15 +0300
commit5d222c099e38bcf329af544ec42ad3dd0644741c (patch)
treeba50aa729f870dbb5d0dc914843161a363599528 /builtin/receive-pack.c
parentb9459019bbb7b864cf59fa307953834996ab4dbe (diff)
receive-pack: avoid minor leak in case start_async() fails
If the asynchronous start of copy_to_sideband() fails, then any env_array entries added to struct child_process proc by prepare_push_cert_sha1() are leaked. Call the latter function only after start_async() succeeded so that the allocated entries are cleaned up automatically by start_command() or finish_command(). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 42f25a5103..99136526c9 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -521,8 +521,6 @@ static int run_and_feed_hook(const char *hook_name, feed_fn feed, void *feed_sta
proc.in = -1;
proc.stdout_to_stderr = 1;
- prepare_push_cert_sha1(&proc);
-
if (use_sideband) {
memset(&muxer, 0, sizeof(muxer));
muxer.proc = copy_to_sideband;
@@ -533,6 +531,8 @@ static int run_and_feed_hook(const char *hook_name, feed_fn feed, void *feed_sta
proc.err = muxer.in;
}
+ prepare_push_cert_sha1(&proc);
+
code = start_command(&proc);
if (code) {
if (use_sideband)