summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-20 09:57:32 -0700
committerJunio C Hamano <gitster@pobox.com>2015-08-20 09:57:38 -0700
commit8b54c23437834b36bbb5f6de2f577400385da770 (patch)
tree1be1514c35a099216b33574ba10cc51f845f0acc /builtin/checkout.c
parent8545932d45c91437ac439b1a2df12cf397f71311 (diff)
downloadgit-8b54c23437834b36bbb5f6de2f577400385da770.tar.gz
ps_matched: xcalloc() takes nmemb and then element sizejc/calloc-pathspec
Even though multiplication is commutative, the order of arguments should be xcalloc(nmemb, size). ps_matched is an array of 1-byte element whose size is the same as the number of pathspec elements. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 3e141fc149..4f826e3b03 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -280,7 +280,7 @@ static int checkout_paths(const struct checkout_opts *opts,
if (opts->source_tree)
read_tree_some(opts->source_tree, &opts->pathspec);
- ps_matched = xcalloc(1, opts->pathspec.nr);
+ ps_matched = xcalloc(opts->pathspec.nr, 1);
/*
* Make sure all pathspecs participated in locating the paths