]> git.ipfire.org Git - thirdparty/git.git/commit
sideband: fix leaks when configuring sideband colors
authorPatrick Steinhardt <ps@pks.im>
Thu, 22 Aug 2024 09:17:49 +0000 (11:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2024 16:18:05 +0000 (09:18 -0700)
commit2a2d5da1f22f91242c482bd7800b3dd03915870a
tree2ee74c561c3e5b96f644324b153c036176f4c811
parenta09efb74e3d3b316519a398618fb6515df4337a7
sideband: fix leaks when configuring sideband colors

We read a bunch of configs in `use_sideband_colors()` to configure the
colors that Git should use. We never free the strings read from the
config though, causing memory leaks.

Refactor the code to use `git_config_get_string_tmp()` instead, which
does not allocate memory. As we throw the strings away after parsing
them anyway there is no need to use allocated strings.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sideband.c
t/t5409-colorize-remote-messages.sh