diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-11-14 16:13:13 +0000 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-14 23:13:14 +0000 |
commit | f7568dbfc8b9a38ad5b81179c83ae5a929b7c9a1 (patch) | |
tree | f44f25d625e2cf77bf4f413e0675810a3946edc9 /src/libostree/ostree-repo-refs.c | |
parent | 6b9ce9d35d9a8d5596b96f72da8f0f3faed3f62c (diff) | |
download | ostree-f7568dbfc8b9a38ad5b81179c83ae5a929b7c9a1.tar.gz |
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
Diffstat (limited to 'src/libostree/ostree-repo-refs.c')
-rw-r--r-- | src/libostree/ostree-repo-refs.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libostree/ostree-repo-refs.c b/src/libostree/ostree-repo-refs.c index 9289bb37..ed496253 100644 --- a/src/libostree/ostree-repo-refs.c +++ b/src/libostree/ostree-repo-refs.c @@ -725,7 +725,8 @@ _ostree_repo_list_refs_internal (OstreeRepo *self, * ostree_repo_list_refs: * @self: Repo * @refspec_prefix: (allow-none): Only list refs which match this prefix - * @out_all_refs: (out) (element-type utf8 utf8): Mapping from ref to checksum + * @out_all_refs: (out) (element-type utf8 utf8) (transfer container): + * Mapping from ref to checksum * @cancellable: Cancellable * @error: Error * @@ -750,7 +751,8 @@ ostree_repo_list_refs (OstreeRepo *self, * ostree_repo_list_refs_ext: * @self: Repo * @refspec_prefix: (allow-none): Only list refs which match this prefix - * @out_all_refs: (out) (element-type utf8 utf8): Mapping from ref to checksum + * @out_all_refs: (out) (element-type utf8 utf8) (transfer container): + * Mapping from ref to checksum * @flags: Options controlling listing behavior * @cancellable: Cancellable * @error: Error @@ -778,7 +780,8 @@ ostree_repo_list_refs_ext (OstreeRepo *self, * ostree_repo_remote_list_refs: * @self: Repo * @remote_name: Name of the remote. - * @out_all_refs: (out) (element-type utf8 utf8): Mapping from ref to checksum + * @out_all_refs: (out) (element-type utf8 utf8) (transfer container): + * Mapping from ref to checksum * @cancellable: Cancellable * @error: Error * @@ -893,7 +896,8 @@ remote_list_collection_refs_process_refs (OstreeRepo *self, * ostree_repo_remote_list_collection_refs: * @self: Repo * @remote_name: Name of the remote. - * @out_all_refs: (out) (element-type OstreeCollectionRef utf8): Mapping from collection–ref to checksum + * @out_all_refs: (out) (element-type OstreeCollectionRef utf8) (transfer container): + * Mapping from collection–ref to checksum * @cancellable: Cancellable * @error: Error * @@ -1165,7 +1169,8 @@ _ostree_repo_update_collection_refs (OstreeRepo *self, * ostree_repo_list_collection_refs: * @self: Repo * @match_collection_id: (nullable): If non-%NULL, only list refs from this collection - * @out_all_refs: (out) (element-type OstreeCollectionRef utf8): Mapping from collection–ref to checksum + * @out_all_refs: (out) (element-type OstreeCollectionRef utf8) (transfer container): + * Mapping from collection–ref to checksum * @flags: Options controlling listing behavior * @cancellable: Cancellable * @error: Error |