Skip to content

Commit e140f7a

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b83d12 commit e140f7a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

blame.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ static void fill_origin_blob(struct diff_options *opt,
314314
static void drop_origin_blob(struct blame_origin *o)
315315
{
316316
if (o->file.ptr) {
317-
free(o->file.ptr);
318-
o->file.ptr = NULL;
317+
FREE_AND_NULL(o->file.ptr);
319318
}
320319
}
321320

ll-merge.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
209209
result->size = st.st_size;
210210
result->ptr = xmallocz(result->size);
211211
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);
214213
result->size = 0;
215214
}
216215
close_bad:

0 commit comments

Comments
 (0)