commit fa2f6902709b3373f9da09bd711b660eeaf6e48c from: Stefan Sperling date: Mon Jul 23 09:30:26 2018 UTC use got_object_qid_free() consistently commit - f831532b96ca120d766ce7c8ee00fdd5a0d7b415 commit + fa2f6902709b3373f9da09bd711b660eeaf6e48c blob - 3942b1d52d713c06359f5bdf4d50f89f4592e602 blob + c4a7d146e41afbc61b3b681580c31e2f26ea95ac --- lib/commit_graph.c +++ lib/commit_graph.c @@ -214,7 +214,7 @@ add_vertex(struct got_object_id_queue *ids, struct got 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; blob - eb8d9b42d58aed00b8c4a6384f1b0797512230ef blob + d026b2cd18dd125bead7b6b9764257a26fb6bd59 --- lib/object.c +++ lib/object.c @@ -485,7 +485,7 @@ got_object_qid_alloc(struct got_object_qid **qid, stru (*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 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 *comm 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);