From e140f7afddcdce2bae062ea1578eac38c744e3a5 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:48 +0000 Subject: coccinelle: make use of the "expression" FREE_AND_NULL() rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A follow-up to the existing "expression" rule added in an earlier change. 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 --- blame.c | 3 +-- ll-merge.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/blame.c b/blame.c index 843c845cba..1183943960 100644 --- a/blame.c +++ b/blame.c @@ -314,8 +314,7 @@ static void fill_origin_blob(struct diff_options *opt, static void drop_origin_blob(struct blame_origin *o) { if (o->file.ptr) { - free(o->file.ptr); - o->file.ptr = NULL; + FREE_AND_NULL(o->file.ptr); } } diff --git a/ll-merge.c b/ll-merge.c index ac0d4a5d78..91ff519cef 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -209,8 +209,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn, result->size = st.st_size; result->ptr = xmallocz(result->size); if (read_in_full(fd, result->ptr, result->size) != result->size) { - free(result->ptr); - result->ptr = NULL; + FREE_AND_NULL(result->ptr); result->size = 0; } close_bad: -- cgit v1.2.3