summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2009-06-30 20:24:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-06-30 23:12:14 (GMT)
commit6167c136579f17066e985a8bf7d9c020878b9a3e (patch)
tree50b9fe5bcc9285346d08ab2a502d1d23301acefd /grep.c
parentb8f262699f6c527b13ff95a322fafc0bfbc5a232 (diff)
downloadgit-6167c136579f17066e985a8bf7d9c020878b9a3e.zip
git-6167c136579f17066e985a8bf7d9c020878b9a3e.tar.gz
git-6167c136579f17066e985a8bf7d9c020878b9a3e.tar.bz2
git.c: avoid allocating one-too-many elements for new argv array
When creating a new argv array from a configured alias and the supplied command line arguments, the new argv was allocated with one element too many. Since the first element of the original argv array is skipped when copying it to the new_argv, the number of elements that are allocated should be reduced by one. 'count' is the number of elements that new_argv contains, and *argcp is the number of elements in the original argv array. So the total allocation (including the terminating NULL entry) for the new_argv array should be: count + (*argcp - 1) + 1 Also, the explicit assignment of the NULL terminating entry can be avoided by just copying it over from the original argv array. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
0 files changed, 0 insertions, 0 deletions