summaryrefslogtreecommitdiffstats
path: root/sideband.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-09-03 18:14:59 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-03 18:15:00 +0200
commit8c1c63d5256edd900200b7f056a946f38c89495d (patch)
tree5a894009e6419ca2ba29ba2031067b457f8bfaba /sideband.c
parentMerge branch 'cl/config-regexp-docfix' (diff)
parenttransport: fix leaking negotiation tips (diff)
downloadgit-8c1c63d5256edd900200b7f056a946f38c89495d.tar.xz
git-8c1c63d5256edd900200b7f056a946f38c89495d.zip
Merge branch 'ps/leakfixes-part-5'
Even more leak fixes. * ps/leakfixes-part-5: transport: fix leaking negotiation tips transport: fix leaking arguments when fetching from bundle builtin/fetch: fix leaking transaction with `--atomic` remote: fix leaking peer ref when expanding refmap remote: fix leaks when matching refspecs remote: fix leaking config strings builtin/fetch-pack: fix leaking refs sideband: fix leaks when configuring sideband colors builtin/send-pack: fix leaking refspecs transport: fix leaking OID arrays in git:// transport data t/helper: fix leaking multi-pack-indices in "read-midx" builtin/repack: fix leaks when computing packs to repack midx-write: fix leaking hashfile on error cases builtin/archive: fix leaking `OPT_FILENAME()` value builtin/upload-archive: fix leaking args passed to `write_archive()` builtin/merge-tree: fix leaking `-X` strategy options pretty: fix leaking key/value separator buffer pretty: fix memory leaks when parsing pretty formats convert: fix leaks when resetting attributes mailinfo: fix leaking header data
Diffstat (limited to 'sideband.c')
-rw-r--r--sideband.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sideband.c b/sideband.c
index 5b6b872a1c..4e816be4e9 100644
--- a/sideband.c
+++ b/sideband.c
@@ -32,28 +32,27 @@ static int use_sideband_colors(void)
const char *key = "color.remote";
struct strbuf sb = STRBUF_INIT;
- char *value;
+ const char *value;
int i;
if (use_sideband_colors_cached >= 0)
return use_sideband_colors_cached;
- if (!git_config_get_string(key, &value)) {
+ if (!git_config_get_string_tmp(key, &value))
use_sideband_colors_cached = git_config_colorbool(key, value);
- } else if (!git_config_get_string("color.ui", &value)) {
+ else if (!git_config_get_string_tmp("color.ui", &value))
use_sideband_colors_cached = git_config_colorbool("color.ui", value);
- } else {
+ else
use_sideband_colors_cached = GIT_COLOR_AUTO;
- }
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
strbuf_reset(&sb);
strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword);
- if (git_config_get_string(sb.buf, &value))
- continue;
- if (color_parse(value, keywords[i].color))
+ if (git_config_get_string_tmp(sb.buf, &value))
continue;
+ color_parse(value, keywords[i].color);
}
+
strbuf_release(&sb);
return use_sideband_colors_cached;
}