Skip to content

Commit

Permalink
Fix double free in test_collection
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis committed Nov 6, 2024
1 parent 123798d commit 89dceb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/dlite-collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ int dlite_collection_deinit(DLiteInstance *inst)
while ((r=dlite_collection_find(coll,&state, NULL, "_has-uuid", NULL,
NULL))) {
if ((inst2 = dlite_instance_get(r->o))) {
dlite_instance_decref(inst2);
dlite_instance_decref(inst2);
dlite_instance_decref(inst2); // remove ref from collection
dlite_instance_decref(inst2); // remove local ref to inst2
} else {
warnx("cannot remove missing instance: %s", r->o);
}
Expand Down
1 change: 0 additions & 1 deletion src/tests/test_collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ MU_TEST(test_collection_load)
//dlite_json_print((DLiteInstance *)inst);
//printf("----------------------\n");
dlite_instance_decref((DLiteInstance *)inst);
dlite_collection_decref(coll2);
}
Expand Down

0 comments on commit 89dceb5

Please sign in to comment.