summaryrefslogtreecommitdiff
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-20 19:23:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-20 19:23:45 (GMT)
commitb67588d018441d1485378a7d9b460401ba8b76a5 (patch)
tree262034e4523b19d1a03a543f26aacffbd0f57b5c /builtin/receive-pack.c
parent713ee7fe46dce859e46dbb255498ff79cdfb7fba (diff)
parent64a7e92f28e9bc053cf68d9b2e9ce4fb40e60e98 (diff)
downloadgit-b67588d018441d1485378a7d9b460401ba8b76a5.zip
git-b67588d018441d1485378a7d9b460401ba8b76a5.tar.gz
git-b67588d018441d1485378a7d9b460401ba8b76a5.tar.bz2
Merge branch 'rs/receive-pack-argv-leak-fix'
* rs/receive-pack-argv-leak-fix: receive-pack: plug minor memory leak in unpack()
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index f2f6c67..6420680 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1230,7 +1230,6 @@ static const char *pack_lockfile;
static const char *unpack(int err_fd, struct shallow_info *si)
{
struct pack_header hdr;
- struct argv_array av = ARGV_ARRAY_INIT;
const char *hdr_err;
int status;
char hdr_arg[38];
@@ -1253,16 +1252,16 @@ static const char *unpack(int err_fd, struct shallow_info *si)
if (si->nr_ours || si->nr_theirs) {
alt_shallow_file = setup_temporary_shallow(si->shallow);
- argv_array_pushl(&av, "--shallow-file", alt_shallow_file, NULL);
+ argv_array_push(&child.args, "--shallow-file");
+ argv_array_push(&child.args, alt_shallow_file);
}
if (ntohl(hdr.hdr_entries) < unpack_limit) {
- argv_array_pushl(&av, "unpack-objects", hdr_arg, NULL);
+ argv_array_pushl(&child.args, "unpack-objects", hdr_arg, NULL);
if (quiet)
- argv_array_push(&av, "-q");
+ argv_array_push(&child.args, "-q");
if (fsck_objects)
- argv_array_push(&av, "--strict");
- child.argv = av.argv;
+ argv_array_push(&child.args, "--strict");
child.no_stdout = 1;
child.err = err_fd;
child.git_cmd = 1;
@@ -1277,13 +1276,12 @@ static const char *unpack(int err_fd, struct shallow_info *si)
if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
strcpy(keep_arg + s, "localhost");
- argv_array_pushl(&av, "index-pack",
+ argv_array_pushl(&child.args, "index-pack",
"--stdin", hdr_arg, keep_arg, NULL);
if (fsck_objects)
- argv_array_push(&av, "--strict");
+ argv_array_push(&child.args, "--strict");
if (fix_thin)
- argv_array_push(&av, "--fix-thin");
- child.argv = av.argv;
+ argv_array_push(&child.args, "--fix-thin");
child.out = -1;
child.err = err_fd;
child.git_cmd = 1;