diff options
author | Jonathan Lebon <jonathan@jlebon.com> | 2019-10-15 11:56:34 -0400 |
---|---|---|
committer | Jonathan Lebon <jonathan@jlebon.com> | 2019-10-15 11:59:45 -0400 |
commit | 9344de1ce1e8c185e01988277606ba1ed7f9d16b (patch) | |
tree | f3aeb33ca9b1c00c7cc9443cb24ea0cd18c96543 /src/libotutil | |
parent | 72c7619bffef10172c2e06606cfd630197a2c16d (diff) | |
download | ostree-9344de1ce1e8c185e01988277606ba1ed7f9d16b.tar.gz |
src/libotutil: Fix strv memory leak
We were only freeing the array and not the members.
Caught by `clang-analyzer` in:
https://github.com/ostreedev/ostree/pull/1931
Diffstat (limited to 'src/libotutil')
-rw-r--r-- | src/libotutil/ot-keyfile-utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c index 9d5903ce..e24f0d29 100644 --- a/src/libotutil/ot-keyfile-utils.c +++ b/src/libotutil/ot-keyfile-utils.c @@ -154,7 +154,7 @@ ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile, guint sep_count = 0; gchar sep = '\0'; g_autofree char *value_str = NULL; - g_autofree char **value_list = NULL; + g_auto(GStrv) value_list = NULL; g_return_val_if_fail (keyfile != NULL, FALSE); g_return_val_if_fail (section != NULL, FALSE); @@ -215,8 +215,8 @@ ot_keyfile_get_string_list_with_default (GKeyFile *keyfile, g_key_file_set_list_separator (keyfile, separator); - g_autofree char **ret_value = g_key_file_get_string_list (keyfile, section, - key, NULL, &temp_error); + g_auto(GStrv) ret_value = g_key_file_get_string_list (keyfile, section, + key, NULL, &temp_error); if (temp_error) { @@ -224,7 +224,7 @@ ot_keyfile_get_string_list_with_default (GKeyFile *keyfile, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { g_clear_error (&temp_error); - ret_value = default_value; + ret_value = g_strdupv (default_value); } else { |