diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-06-06 21:49:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-06 21:49:23 +0200 |
commit | cf792653ad407badec34e67612231676057f9532 (patch) | |
tree | 9bf1e8c130b89f468e10ec979f07089e622133f1 /setup.c | |
parent | The tenth batch (diff) | |
parent | builtin/mv: fix leaks for submodule gitfile paths (diff) | |
download | git-cf792653ad407badec34e67612231676057f9532.tar.xz git-cf792653ad407badec34e67612231676057f9532.zip |
Merge branch 'ps/leakfixes'
Leakfixes.
* ps/leakfixes:
builtin/mv: fix leaks for submodule gitfile paths
builtin/mv: refactor to use `struct strvec`
builtin/mv duplicate string list memory
builtin/mv: refactor `add_slash()` to always return allocated strings
strvec: add functions to replace and remove strings
submodule: fix leaking memory for submodule entries
commit-reach: fix memory leak in `ahead_behind()`
builtin/credential: clear credential before exit
config: plug various memory leaks
config: clarify memory ownership in `git_config_string()`
builtin/log: stop using globals for format config
builtin/log: stop using globals for log config
convert: refactor code to clarify ownership of check_roundtrip_encoding
diff: refactor code to clarify memory ownership of prefixes
config: clarify memory ownership in `git_config_pathname()`
http: refactor code to clarify memory ownership
checkout: clarify memory ownership in `unique_tracking_name()`
strbuf: fix leak when `appendwholeline()` fails with EOF
transport-helper: fix leaking helper name
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1230,13 +1230,13 @@ static int safe_directory_cb(const char *key, const char *value, } else if (!strcmp(value, "*")) { data->is_safe = 1; } else { - const char *interpolated = NULL; + char *interpolated = NULL; if (!git_config_pathname(&interpolated, key, value) && !fspathcmp(data->path, interpolated ? interpolated : value)) data->is_safe = 1; - free((char *)interpolated); + free(interpolated); } return 0; @@ -1875,7 +1875,7 @@ static int template_dir_cb(const char *key, const char *value, char *path = NULL; FREE_AND_NULL(data->path); - if (!git_config_pathname((const char **)&path, key, value)) + if (!git_config_pathname(&path, key, value)) data->path = path ? path : xstrdup(value); } |