summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-08 14:48:41 -0700
committerJunio C Hamano <gitster@pobox.com>2016-08-08 14:48:41 -0700
commit68e80da479ff940aea3f34447336e523b448f34c (patch)
tree077a06f3e0602a16a0cf39b1636566809747fe3d /refs.c
parent09ee6444f22b3745d29dc0d8fa5560651bbe8c19 (diff)
parent50492f7b38f84619cbfb443efc3c0c78fc0304dd (diff)
downloadgit-68e80da479ff940aea3f34447336e523b448f34c.tar.gz
Merge branch 'rs/st-mult'
Micro optimization of st_mult() facility used to check the integer overflow coming from multiplication to compute size of memory allocation. * rs/st-mult: pass constants as first argument to st_mult()
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 814cad3163..b4e7cac7b2 100644
--- a/refs.c
+++ b/refs.c
@@ -922,7 +922,7 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
/* -2 for strlen("%.*s") - strlen("%s"); +1 for NUL */
total_len += strlen(ref_rev_parse_rules[nr_rules]) - 2 + 1;
- scanf_fmts = xmalloc(st_add(st_mult(nr_rules, sizeof(char *)), total_len));
+ scanf_fmts = xmalloc(st_add(st_mult(sizeof(char *), nr_rules), total_len));
offset = 0;
for (i = 0; i < nr_rules; i++) {