Re: [PATCH v4 04/13] commit-graph: implement write_commit_graph()
From: SZEDER Gábor <hidden>
Date: 2018-02-26 16:10:25
From: SZEDER Gábor <hidden>
Date: 2018-02-26 16:10:25
On Mon, Feb 19, 2018 at 7:53 PM, Derrick Stolee [off-list ref] 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'.)