coccinelle: make use of the "type" FREE_AND_NULL() rule
[gitweb.git] / builtin / index-pack.c
index 04b9dcaf0f4ca90712cbb85cace521e226194f3b..f3b16520c2e838fd6fb29aaa61e548fc7218b9c4 100644 (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;
 }