diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-08-14 08:52:50 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 10:08:01 -0700 |
commit | 38678e5df55b77e98b47e7847faf83451eb161de (patch) | |
tree | 53a018a71f6eb23f5bfe88a0494ae635caa807a6 /diff.c | |
parent | 1bc158e7509851d9cb007273c9f75a238f295d2e (diff) |
userdiff: fix leaking memory for configured diff drivers
The userdiff structures may be initialized either statically on the
stack or dynamically via configuration keys. In the latter case we end
up leaking memory because we didn't have any infrastructure to discern
those strings which have been allocated statically and those which have
been allocated dynamically.
Refactor the code such that we have two pointers for each of these
strings: one that holds the value as accessed by other subsystems, and
one that points to the same string in case it has been allocated. Like
this, we can safely free the second pointer and thus plug those memory
leaks.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions