diff options
author | Martin Ågren <martin.agren@gmail.com> | 2017-09-23 01:34:49 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-24 10:05:45 +0900 |
commit | dd1055ed594f8fef18779cce3cd921c4ac66cf9c (patch) | |
tree | 7fe9a6fdbad0882ecfa07e1be9a19a69b5062b6a /t/perf/p0005-status.sh | |
parent | RelNotes: further fixes for 2.14.2 from the master front (diff) | |
download | tgif-dd1055ed594f8fef18779cce3cd921c4ac66cf9c.tar.xz |
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 't/perf/p0005-status.sh')
0 files changed, 0 insertions, 0 deletions