summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-03-10 19:13:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-10 19:13:43 (GMT)
commitb7a6ec609ff10652541e7f716fcecf7865b94b23 (patch)
tree92c449ecb681311c3713a1d2be178776b05bd259 /remote-curl.c
parentaa6c22ec43fa9e2ac531360b5f274446e27d8be1 (diff)
parent8d5b3325e72444d365ded113487d2345c365f6d3 (diff)
downloadgit-b7a6ec609ff10652541e7f716fcecf7865b94b23.zip
git-b7a6ec609ff10652541e7f716fcecf7865b94b23.tar.gz
git-b7a6ec609ff10652541e7f716fcecf7865b94b23.tar.bz2
Merge branch 'jk/tighten-alloc' into maint
* jk/tighten-alloc: (23 commits) compat/mingw: brown paper bag fix for 50a6c8e ewah: convert to REALLOC_ARRAY, etc convert ewah/bitmap code to use xmalloc diff_populate_gitlink: use a strbuf transport_anonymize_url: use xstrfmt git-compat-util: drop mempcpy compat code sequencer: simplify memory allocation of get_message test-path-utils: fix normalize_path_copy output buffer size fetch-pack: simplify add_sought_entry fast-import: simplify allocation in start_packfile write_untracked_extension: use FLEX_ALLOC helper prepare_{git,shell}_cmd: use argv_array use st_add and st_mult for allocation size computation convert trivial cases to FLEX_ARRAY macros use xmallocz to avoid size arithmetic convert trivial cases to ALLOC_ARRAY convert manual allocations to argv_array argv-array: add detach function add helpers for allocating flex-array structs harden REALLOC_ARRAY and xcalloc against size_t overflow ...
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/remote-curl.c b/remote-curl.c
index e114f24..e65ea59 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -708,9 +708,10 @@ static int rpc_service(struct rpc_state *rpc, struct discovery *heads)
static int fetch_dumb(int nr_heads, struct ref **to_fetch)
{
struct walker *walker;
- char **targets = xmalloc(nr_heads * sizeof(char*));
+ char **targets;
int ret, i;
+ ALLOC_ARRAY(targets, nr_heads);
if (options.depth)
die("dumb http transport does not support --depth");
for (i = 0; i < nr_heads; i++)
@@ -857,23 +858,22 @@ static void parse_fetch(struct strbuf *buf)
static int push_dav(int nr_spec, char **specs)
{
- const char **argv = xmalloc((10 + nr_spec) * sizeof(char*));
- int argc = 0, i;
+ struct child_process child = CHILD_PROCESS_INIT;
+ size_t i;
- argv[argc++] = "http-push";
- argv[argc++] = "--helper-status";
+ child.git_cmd = 1;
+ argv_array_push(&child.args, "http-push");
+ argv_array_push(&child.args, "--helper-status");
if (options.dry_run)
- argv[argc++] = "--dry-run";
+ argv_array_push(&child.args, "--dry-run");
if (options.verbosity > 1)
- argv[argc++] = "--verbose";
- argv[argc++] = url.buf;
+ argv_array_push(&child.args, "--verbose");
+ argv_array_push(&child.args, url.buf);
for (i = 0; i < nr_spec; i++)
- argv[argc++] = specs[i];
- argv[argc++] = NULL;
+ argv_array_push(&child.args, specs[i]);
- if (run_command_v_opt(argv, RUN_GIT_CMD))
- die("git-%s failed", argv[0]);
- free(argv);
+ if (run_command(&child))
+ die("git-http-push failed");
return 0;
}