lib/repo: Add (transfer) annotations to various GHashTable arguments
authorPhilip Withnall <withnall@endlessm.com>
Tue, 14 Nov 2017 16:13:13 +0000 (16:13 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 14 Nov 2017 23:13:14 +0000 (23:13 +0000)
commitf7568dbfc8b9a38ad5b81179c83ae5a929b7c9a1
treef44f25d625e2cf77bf4f413e0675810a3946edc9
parent6b9ce9d35d9a8d5596b96f72da8f0f3faed3f62c
lib/repo: Add (transfer) annotations to various GHashTable arguments

By default, unless it’s const, an (out) GHashTable will be assumed to be
(transfer full). That means the binding needs to free all the items in
the hash table, plus the table itself.

However, all the GHashTables we use have free functions set already, so
freeing the hash table will free its items. This results in a
double-free.

Fix that by ensuring we annotate such (out) hash tables as (transfer
container). Also annotate some other hash tables as (transfer none)
where appropriate, for clarity.

This fixes OSTree.Repo.list_collection_refs() in the Python bindings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1341
Approved by: dbnicholson
src/libostree/ostree-repo-finder.c
src/libostree/ostree-repo-refs.c
src/libostree/ostree-soup-form.c
src/libostree/ostree-soup-uri.c