config: clarify memory ownership in git_config_pathname()
The out parameter of `git_config_pathname()` is a `const char **` even though we transfer ownership of memory to the caller. This is quite misleading and has led to many memory leaks all over the place. Adapt the parameter to instead be `char **`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f962ffc392
commit
6073b3b5c3
4
fsck.c
4
fsck.c
@@ -1330,13 +1330,13 @@ int git_fsck_config(const char *var, const char *value,
|
||||
const char *msg_id;
|
||||
|
||||
if (strcmp(var, "fsck.skiplist") == 0) {
|
||||
const char *path;
|
||||
char *path;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (git_config_pathname(&path, var, value))
|
||||
return 1;
|
||||
strbuf_addf(&sb, "skiplist=%s", path);
|
||||
free((char *)path);
|
||||
free(path);
|
||||
fsck_set_msg_types(options, sb.buf);
|
||||
strbuf_release(&sb);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user