summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-06-15 23:15:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-16 19:44:07 (GMT)
commite140f7afddcdce2bae062ea1578eac38c744e3a5 (patch)
treedf54a2725f418f14c64d7c0e97cb189cdbecd8c5
parent1b83d1251edbfb49feb84c0c32d241a63e2118a9 (diff)
downloadgit-e140f7afddcdce2bae062ea1578eac38c744e3a5.zip
git-e140f7afddcdce2bae062ea1578eac38c744e3a5.tar.gz
git-e140f7afddcdce2bae062ea1578eac38c744e3a5.tar.bz2
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>
-rw-r--r--blame.c3
-rw-r--r--ll-merge.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/blame.c b/blame.c
index 843c845..1183943 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 ac0d4a5..91ff519 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: