From 6a83d902073803c4141e02c53decf8c03e35da27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 15 Jun 2017 23:15:46 +0000 Subject: coccinelle: make use of the "type" FREE_AND_NULL() rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- tree-diff.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tree-diff.c') diff --git a/tree-diff.c b/tree-diff.c index e164e532b..1e1b393d0 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -140,8 +140,7 @@ static struct combine_diff_path *path_appendnew(struct combine_diff_path *last, /* if last->next is !NULL - it is a pre-allocated memory, we can reuse */ p = last->next; if (p && (alloclen > (intptr_t)p->next)) { - free(p); - p = NULL; + FREE_AND_NULL(p); } if (!p) { @@ -559,8 +558,7 @@ struct combine_diff_path *diff_tree_paths( * (see path_appendnew() for details about why) */ if (p->next) { - free(p->next); - p->next = NULL; + FREE_AND_NULL(p->next); } return p; -- cgit v1.2.1