summaryrefslogtreecommitdiff
path: root/builtin/show-branch.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2015-06-26 05:03:31 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-06-26 09:23:08 -0700
commit38ae8784074852c8e7b651f4f6e44e07466da7e1 (patch)
tree44ca3f69a322f6019126661e2f3714f10efec71a /builtin/show-branch.c
parentclean: improve performance when removing lots of directories (diff)
downloadtgif-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 'builtin/show-branch.c')
0 files changed, 0 insertions, 0 deletions