diff options
author | Jeff King <peff@peff.net> | 2022-09-08 08:02:50 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-09-08 21:11:28 +0300 |
commit | 66eede4a37c3e17ccadbd99fe0f07a4a133d495d (patch) | |
tree | da3fddb312449cf67b6901c310fc7a7a55b8b77d /transport.c | |
parent | 7e2619d8ff07ddcf45f8685bbd587ba4997b3a54 (diff) |
prepare_repo_settings(): plug leak of config values
We call repo_config_get_string() for fetch.negotiationAlgorithm, which
allocates a copy of the string, but we never free it.
We could add a call to free(), but there's an even simpler solution: we
don't need the string to persist beyond a few strcasecmp() calls, so we
can instead use the "_tmp" variant which gives us a const pointer to the
cached value.
We need to switch the type of "strval" to "const char *" for this to
work, which affects a similar call that checks core.untrackedCache. But
it's in the same boat! It doesn't actually need the value to persist
beyond a maybe_bool() check (though it does remember to correctly free
the string afterwards). So we can simplify it at the same time.
Note that this core.untrackedCache check arguably should be using
repo_config_get_maybe_bool(), but there are some subtle behavior
changes. E.g., it doesn't currently allow a value-less "true". Arguably
it should, but let's avoid lumping further changes in what should be a
simple leak cleanup.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
0 files changed, 0 insertions, 0 deletions