summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-09-23 01:34:49 +0200
committerJunio C Hamano <gitster@pobox.com>2017-09-24 10:05:45 +0900
commitdd1055ed594f8fef18779cce3cd921c4ac66cf9c (patch)
tree7fe9a6fdbad0882ecfa07e1be9a19a69b5062b6a /commit.c
parent94c9fd268d4287f6fbfef84793288479905a7e48 (diff)
downloadgit-dd1055ed594f8fef18779cce3cd921c4ac66cf9c.tar.gz
builtin/commit: fix memory leak in `prepare_index()`
Release `pathspec` and the string list `partial`. When we clear the string list, make sure we do not free the `util` pointers. That would result in double-freeing, since we set them up as `item->util = item` in `list_paths()`. Initialize the string list early, so that we can always release it. That introduces some unnecessary overhead in various code paths, but means there is one and only one way out of the function. If we ever accumulate more things we need to free, it should be straightforward to do so. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions