diff options
author | Jeff King <peff@peff.net> | 2015-06-26 05:03:31 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-26 09:23:08 -0700 |
commit | 38ae8784074852c8e7b651f4f6e44e07466da7e1 (patch) | |
tree | 44ca3f69a322f6019126661e2f3714f10efec71a /t | |
parent | clean: improve performance when removing lots of directories (diff) | |
download | tgif-38ae8784074852c8e7b651f4f6e44e07466da7e1.tar.xz |
read_gitfile_gently: fix use-after-free
The "dir" variable is a pointer into the "buf" array. When
we hit the cleanup_return path, the first thing we do is
free(buf); but one of the error messages prints "dir", which
will access the memory after the free.
We can fix this by reorganizing the error path a little. We
act on the fatal, error-printing conditions first, as they
want to access memory and do not care about freeing. Then we
free any memory, and finally return.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
0 files changed, 0 insertions, 0 deletions