Skip to content

Commit

Permalink
Don't leak memory when testing the old APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Oct 9, 2023
1 parent 308f7f9 commit 7d3450f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/src/unit-capi-group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,14 @@ std::vector<std::pair<tiledb::sm::URI, tiledb_object_t>> GroupFx::read_group(
std::string uri;
tiledb_object_t type;
char *uri_ptr, *name_ptr;
// NOTE: The following function leaks memory.
rc = tiledb_group_get_member_by_index(
ctx_, group, i, &uri_ptr, &type, &name_ptr);
REQUIRE(rc == TILEDB_OK);
uri = uri_ptr == nullptr ? "" : std::string(uri_ptr);
std::free(uri_ptr);
if (name_ptr) {
std::free(name_ptr);
}
ret.emplace_back(uri, type);
}
}
Expand Down

0 comments on commit 7d3450f

Please sign in to comment.