notes: don't leak memory in git_config_get_notes_strategy

This function asks for the value of a configuration and after using the value does not have to retain ownership of it. git_config_get_string_const() however is a function to get a copy of the value, but we forget to free it before we return. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 31, 2016 at 17:35 UTC 344b548475b86f9f95e9fbcd93022f8083918cc7
1 file changed +3 -2
builtin/notes.c
+3 -2
@@ -741,13 +741,14 @@ static int merge_commit(struct notes_merge_options *o)
741 static int git_config_get_notes_strategy(const char *key,
742 enum notes_merge_strategy *strategy)
743 {
744 - const char *value;
744 + char *value;
745
746 - if (git_config_get_string_const(key, &value))
746 + if (git_config_get_string(key, &value))
747 return 1;
748 if (parse_notes_merge_strategy(value, strategy))
749 git_die_config(key, "unknown notes merge strategy %s", value);
750
751 + free(value);
752 return 0;
753 }
754