use got_object_qid_free() consistently
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index 3942b1d..c4a7d14 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -214,7 +214,7 @@ add_vertex(struct got_object_id_queue *ids, struct got_object_id *id)
qid->id = got_object_id_dup(id);
if (qid->id == NULL) {
const struct got_error *err = got_error_from_errno();
- free(qid);
+ got_object_qid_free(qid);
return err;
}
@@ -263,12 +263,12 @@ free_node(struct got_commit_graph_node *node)
while (!SIMPLEQ_EMPTY(&node->child_ids)) {
struct got_object_qid *child = SIMPLEQ_FIRST(&node->child_ids);
SIMPLEQ_REMOVE_HEAD(&node->child_ids, entry);
- free(child);
+ got_object_qid_free(child);
}
while (!SIMPLEQ_EMPTY(&node->parent_ids)) {
struct got_object_qid *pid = SIMPLEQ_FIRST(&node->parent_ids);
SIMPLEQ_REMOVE_HEAD(&node->parent_ids, entry);
- free(pid);
+ got_object_qid_free(pid);
}
free(node);
}
@@ -280,7 +280,7 @@ add_node(struct got_commit_graph_node **new_node,
{
const struct got_error *err = NULL;
struct got_commit_graph_node *node, *existing_node;
- struct got_object_qid *qid;
+ struct got_object_qid *pid;
*new_node = NULL;
@@ -291,8 +291,8 @@ add_node(struct got_commit_graph_node **new_node,
memcpy(&node->id, commit_id, sizeof(node->id));
SIMPLEQ_INIT(&node->parent_ids);
SIMPLEQ_INIT(&node->child_ids);
- SIMPLEQ_FOREACH(qid, &commit->parent_ids, entry) {
- err = add_vertex(&node->parent_ids, qid->id);
+ SIMPLEQ_FOREACH(pid, &commit->parent_ids, entry) {
+ err = add_vertex(&node->parent_ids, pid->id);
if (err) {
free_node(node);
return err;
diff --git a/lib/object.c b/lib/object.c
index eb8d9b4..d026b2c 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -485,7 +485,7 @@ got_object_qid_alloc(struct got_object_qid **qid, struct got_object_id *id)
(*qid)->id = got_object_id_dup(id);
if ((*qid)->id == NULL) {
err = got_error_from_errno();
- free(*qid);
+ got_object_qid_free(*qid);
*qid = NULL;
return err;
}
@@ -514,7 +514,7 @@ got_object_commit_add_parent(struct got_commit_object *commit,
qid->id = malloc(sizeof(*qid->id));
if (qid->id == NULL) {
err = got_error_from_errno();
- free(qid);
+ got_object_qid_free(qid);
return err;
}
@@ -1039,8 +1039,7 @@ got_object_commit_close(struct got_commit_object *commit)
while (!SIMPLEQ_EMPTY(&commit->parent_ids)) {
qid = SIMPLEQ_FIRST(&commit->parent_ids);
SIMPLEQ_REMOVE_HEAD(&commit->parent_ids, entry);
- free(qid->id);
- free(qid);
+ got_object_qid_free(qid);
}
free(commit->tree_id);