On Mon, Feb 19, 2018 at 7:53 PM, Derrick Stolee <[email protected]> wrote:
> +static int if_packed_commit_add_to_list(const struct object_id *oid,
> + struct packed_git *pack,
> + uint32_t pos,
> + void *data)
> +{
> + struct packed_oid_list *list = (struct packed_oid_list*)data;
> + enum object_type type;
> + unsigned long size;
> + void *inner_data;
> + off_t offset = nth_packed_object_offset(pack, pos);
> + inner_data = unpack_entry(pack, offset, &type, &size);
> +
> + if (inner_data)
> + free(inner_data);
The condition is unnecessary, free() can handle a NULL argument just fine.
(Suggested by Coccinelle and 'contrib/coccinelle/free.cocci.patch'.)