coccinelle: make use of the "type" FREE_AND_NULL() rule

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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2017-06-15 23:15:46 +00:00
committed by Junio C Hamano
parent cf9f49ea48
commit 6a83d90207
37 changed files with 71 additions and 142 deletions

View File

@ -388,8 +388,7 @@ static struct base_data *alloc_base_data(void)
static void free_base_data(struct base_data *c)
{
if (c->data) {
free(c->data);
c->data = NULL;
FREE_AND_NULL(c->data);
get_thread_data()->base_cache_used -= c->size;
}
}
@ -605,8 +604,7 @@ static void *unpack_data(struct object_entry *obj,
git_inflate_end(&stream);
free(inbuf);
if (consume) {
free(data);
data = NULL;
FREE_AND_NULL(data);
}
return data;
}