summaryrefslogtreecommitdiff
path: root/builtin/config.c
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2017-06-15 23:15:46 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-06-16 12:44:03 -0700
commit6a83d902073803c4141e02c53decf8c03e35da27 (patch)
tree209cf1639a325875240fce3e1f1cabbdb25878df /builtin/config.c
parentcoccinelle: add a rule to make "type" code use FREE_AND_NULL() (diff)
downloadtgif-6a83d902073803c4141e02c53decf8c03e35da27.tar.xz
coccinelle: make use of the "type" FREE_AND_NULL() rule
Apply the result of the just-added coccinelle rule. This manually excludes a few occurrences, mostly things that resulted in many FREE_AND_NULL() on one line, that'll be manually fixed in a subsequent change. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/config.c')
-rw-r--r--builtin/config.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin/config.c b/builtin/config.c
index 7f6c25d4d9..18c2158630 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -214,8 +214,7 @@ static int get_value(const char *key_, const char *regex_)
key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(key_regexp, key, REG_EXTENDED)) {
error("invalid key pattern: %s", key_);
- free(key_regexp);
- key_regexp = NULL;
+ FREE_AND_NULL(key_regexp);
ret = CONFIG_INVALID_PATTERN;
goto free_strings;
}
@@ -235,8 +234,7 @@ static int get_value(const char *key_, const char *regex_)
regexp = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(regexp, regex_, REG_EXTENDED)) {
error("invalid pattern: %s", regex_);
- free(regexp);
- regexp = NULL;
+ FREE_AND_NULL(regexp);
ret = CONFIG_INVALID_PATTERN;
goto free_strings;
}