Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/traverse: Fix minor memory leak #3287

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/libostree/ostree-repo-traverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,13 @@ parents_get_commits (GHashTable *parents_ht, GVariant *object, GHashTable *res)
char **
ostree_repo_traverse_parents_get_commits (GHashTable *parents, GVariant *object)
{
g_autoptr (GHashTable) res = g_hash_table_new (g_str_hash, g_str_equal);
g_autoptr (GHashTable) res = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);

parents_get_commits (parents, object, res);

return (char **)g_hash_table_get_keys_as_array (res, NULL);
// TODO: Once we can depend on modern glib 2.76, just use g_hash_table_steal_all_keys
g_autofree char **tmpbuf = (char **)g_hash_table_get_keys_as_array (res, NULL);
return g_strdupv (tmpbuf);
}

static gboolean traverse_dirtree (OstreeRepo *repo, const char *checksum, GVariant *parent_key,
Expand Down
Loading