summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-04-06 11:11:12 -0700
committerJunio C Hamano <gitster@pobox.com>2024-04-08 13:20:24 -0700
commit0e0fefb29fde59b6703d3b45987823fe85c00706 (patch)
treef3fef5ae0badb949dc1603487ea5bbc566bf1479 /builtin/commit.c
parent0d1bd1dfb37ef25e1911777c94129fc769ffec38 (diff)
config: do not leak excludes_file
The excludes_file variable is marked "const char *", but all the assignments to it are made with a piece of memory allocated just for it, and the variable is responsible for owning it. When "core.excludesfile" is read, the code just lost the previous value, leaking memory. Plug it. The real problem is that the variable is mistyped; our convention is to never make a variable that owns the piece of memory pointed by it as "const". Fixing that would reduce the chance of this kind of bug happening, and also would make it unnecessary to cast the constness away while free()ing it, but that would be a much larger follow-up effort. Reported-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions