[ostree] core: Fix a few memory leaks
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Fix a few memory leaks
- Date: Mon, 2 Apr 2012 22:34:12 +0000 (UTC)
commit a0b7d94cb63d36a5f4bc41540390edb16eb79e4a
Author: Colin Walters <walters verbum org>
Date: Mon Apr 2 17:41:04 2012 -0400
core: Fix a few memory leaks
src/libostree/ostree-core.c | 4 ++--
src/libostree/ostree-repo.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 7d6849a..06897a2 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -1289,6 +1289,7 @@ ostree_read_pack_entry_raw (guchar *pack_data,
ret_entry = g_variant_new_from_data (OSTREE_PACK_FILE_CONTENT_VARIANT_FORMAT,
pack_data+entry_start, entry_len,
trusted, NULL, NULL);
+ g_variant_ref_sink (ret_entry);
ret = TRUE;
ot_transfer_out_value (out_entry, &ret_entry);
out:
@@ -1324,6 +1325,7 @@ ostree_read_pack_entry_as_stream (GVariant *pack_entry)
"base-stream", memory_input,
"close-base-stream", TRUE,
NULL);
+ g_object_unref (memory_input);
g_object_unref (decompressor);
}
else
@@ -1355,8 +1357,6 @@ ostree_read_pack_entry_variant (GVariant *pack_entry,
trusted, &container_variant, cancellable, error))
goto out;
- g_variant_ref_sink (container_variant);
-
g_variant_get (container_variant, "(uv)",
&actual_type, &ret_variant);
actual_type = GUINT32_FROM_BE (actual_type);
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index aeb7346..8ea4bbd 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -3298,6 +3298,7 @@ ostree_repo_load_file (OstreeRepo *self,
out:
g_free (content_pack_checksum);
g_clear_object (&ret_input);
+ g_clear_object (&content_loose_path);
g_clear_object (&content_loose_info);
g_clear_object (&ret_file_info);
ot_clear_gvariant (&ret_xattrs);
@@ -3371,9 +3372,8 @@ list_objects_in_index (OstreeRepo *self,
g_variant_builder_add (&pack_contents_builder, "s", pack_checksum);
objdata = g_variant_new ("(b as)", is_loose,
g_variant_builder_end (&pack_contents_builder));
- g_hash_table_replace (inout_objects,
- obj_key,
- g_variant_ref (objdata));
+ g_variant_ref_sink (objdata);
+ g_hash_table_replace (inout_objects, obj_key, objdata);
}
ret = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]