diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-05-27 13:46:44 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-27 11:20:00 -0700 |
| commit | 49eb597ce08de7fc4837155fa7910dace92b9ae6 (patch) | |
| tree | 1f425f0483e0c7355ae17bd34c5fbb334b08dabc /alias.c | |
| parent | 1b261c20ed28ad26ddbcd3dff94a248ac6866ac8 (diff) | |
| download | git-49eb597ce08de7fc4837155fa7910dace92b9ae6.tar.gz | |
config: plug various memory leaks
Now that memory ownership rules around `git_config_string()` and
`git_config_pathname()` are clearer, it also got easier to spot that
the returned memory needs to be free'd. Plug a subset of those cases and
mark now-passing tests as leak free.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'alias.c')
| -rw-r--r-- | alias.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -21,9 +21,11 @@ static int config_alias_cb(const char *key, const char *value, return 0; if (data->alias) { - if (!strcasecmp(p, data->alias)) + if (!strcasecmp(p, data->alias)) { + FREE_AND_NULL(data->v); return git_config_string(&data->v, key, value); + } } else if (data->list) { string_list_append(data->list, p); } |
