[dbus PATCH] Fix memory leaks introduced by commits 40dc3b and 408a25

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 src/domain.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/domain.c b/src/domain.c
index 6c44377..ae1b68f 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -506,7 +506,7 @@ virtDBusDomainBlockPeek(GVariant *inArgs,
     gsize size;
     guint flags;
     g_autofree guchar *buffer = NULL;
-    GVariantBuilder *builder;
+    GVariantBuilder builder;
     GVariant *res;
 
     g_variant_get(inArgs, "(&sttu)", &disk, &offset, &size, &flags);
@@ -519,11 +519,11 @@ virtDBusDomainBlockPeek(GVariant *inArgs,
     if (virDomainBlockPeek(domain, disk, offset, size, buffer, flags) < 0)
         return virtDBusUtilSetLastVirtError(error);
 
-    builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+    g_variant_builder_init(&builder, G_VARIANT_TYPE("ay"));
     for (unsigned int i = 0; i < size; i++)
-        g_variant_builder_add(builder, "y", buffer[i]);
+        g_variant_builder_add(&builder, "y", buffer[i]);
 
-    res = g_variant_builder_end(builder);
+    res = g_variant_builder_end(&builder);
 
     *outArgs = g_variant_new_tuple(&res, 1);
 }
@@ -1221,7 +1221,7 @@ virtDBusDomainMemoryPeek(GVariant *inArgs,
     gsize size;
     guint flags;
     g_autofree guchar *buffer = NULL;
-    GVariantBuilder *builder;
+    GVariantBuilder builder;
     GVariant *res;
 
     g_variant_get(inArgs, "(ttu)", &offset, &size, &flags);
@@ -1234,11 +1234,11 @@ virtDBusDomainMemoryPeek(GVariant *inArgs,
     if (virDomainMemoryPeek(domain, offset, size, buffer, flags) < 0)
         return virtDBusUtilSetLastVirtError(error);
 
-    builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+    g_variant_builder_init(&builder, G_VARIANT_TYPE("ay"));
     for (unsigned int i = 0; i < size; i++)
-        g_variant_builder_add(builder, "y", buffer[i]);
+        g_variant_builder_add(&builder, "y", buffer[i]);
 
-    res = g_variant_builder_end(builder);
+    res = g_variant_builder_end(&builder);
 
     *outArgs = g_variant_new_tuple(&res, 1);
 }
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux