summaryrefslogtreecommitdiff
path: root/walker.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-02-14 12:54:23 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-02-14 12:54:23 -0800
commitaa21cc97bd10ab0b62f6d951ff2ff725261e326e (patch)
tree69e983408fd1a4f599ea00d6b70599a00282be06 /walker.c
parentMerge branch 'jh/notes-fanout-fix' (diff)
parenttree-walk.c: break circular dependency with unpack-trees (diff)
downloadtgif-aa21cc97bd10ab0b62f6d951ff2ff725261e326e.tar.xz
Merge branch 'jk/alloc-cleanups'
Misc code clean-ups. * jk/alloc-cleanups: tree-walk.c: break circular dependency with unpack-trees traverse_trees(): use stack array for name entries walker_fetch(): avoid raw array length computation normalize_path_copy(): document "dst" size expectations
Diffstat (limited to 'walker.c')
-rw-r--r--walker.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/walker.c b/walker.c
index 06cd2bd569..bb010f7a2b 100644
--- a/walker.c
+++ b/walker.c
@@ -261,12 +261,14 @@ int walker_fetch(struct walker *walker, int targets, char **target,
struct strbuf refname = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
struct ref_transaction *transaction = NULL;
- struct object_id *oids = xmalloc(targets * sizeof(struct object_id));
+ struct object_id *oids;
char *msg = NULL;
int i, ret = -1;
save_commit_buffer = 0;
+ ALLOC_ARRAY(oids, targets);
+
if (write_ref) {
transaction = ref_transaction_begin(&err);
if (!transaction) {