coccinelle: make use of the "expression" FREE_AND_NULL() rule
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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Jun 15, 2017 at 23:15 UTC
e140f7afddcdce2bae062ea1578eac38c744e3a5
2 files changed
+2
-4
blame.c
+1
-2
@@ -314,8 +314,7 @@ static void fill_origin_blob(struct diff_options *opt,
314
static void drop_origin_blob(struct blame_origin *o)
315
{
316
if (o->file.ptr) {
317
- free(o->file.ptr);
318
- o->file.ptr = NULL;
317
+ FREE_AND_NULL(o->file.ptr);
318
}
319
}
320
ll-merge.c
+1
-2
@@ -209,8 +209,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
209
result->size = st.st_size;
210
result->ptr = xmallocz(result->size);
211
if (read_in_full(fd, result->ptr, result->size) != result->size) {
212
- free(result->ptr);
213
- result->ptr = NULL;
212
+ FREE_AND_NULL(result->ptr);
213
result->size = 0;
214
}
215
close_bad: