[libvirt] [dbus PATCH] Fix GError memory leaks

Pavel Hrdina posted 1 patch 6 years ago
Failed in applying to current master (apply log)
src/gdbus.c | 8 ++++----
src/main.c  | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
[libvirt] [dbus PATCH] Fix GError memory leaks
Posted by Pavel Hrdina 6 years ago
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/gdbus.c | 8 ++++----
 src/main.c  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gdbus.c b/src/gdbus.c
index cb06813..3407116 100644
--- a/src/gdbus.c
+++ b/src/gdbus.c
@@ -86,7 +86,7 @@ virtDBusGDBusHandlePropertyGet(GVariant *parameters,
     const gchar *interface;
     const gchar *name;
     GVariant *value = NULL;
-    GError *error = NULL;
+    g_autoptr(GError) error = NULL;
 
     g_variant_get(parameters, "(&s&s)", &interface, &name);
 
@@ -128,7 +128,7 @@ virtDBusGDBusHandlePropertySet(GVariant *parameters,
     const gchar *interface;
     const gchar *name;
     g_autoptr(GVariant) value = NULL;
-    GError *error = NULL;
+    g_autoptr(GError) error = NULL;
 
     g_variant_get(parameters, "(&s&sv)", &interface, &name, &value);
 
@@ -162,7 +162,7 @@ virtDBusGDBusHandlePropertyGetAll(GDBusMethodInvocation *invocation,
 {
     GVariant *value;
     g_auto(GVariantBuilder) builder;
-    GError *error = NULL;
+    g_autoptr(GError) error = NULL;
 
     g_variant_builder_init(&builder, G_VARIANT_TYPE("(a{sv})"));
 
@@ -202,7 +202,7 @@ virtDBusGDBusHandleMethod(GVariant *parameters,
     GUnixFDList *inFDs = NULL;
     GVariant *outArgs = NULL;
     GUnixFDList *outFDs = NULL;
-    GError *error = NULL;
+    g_autoptr(GError) error = NULL;
 
     for (gint i = 0; data->methods[i].name; i++) {
         if (g_str_equal(methodName, data->methods[i].name)) {
diff --git a/src/main.c b/src/main.c
index b3baf76..eb30ef8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,7 +52,7 @@ virtDBusAcquired(GDBusConnection *connection,
                  gpointer opaque)
 {
     virtDBusRegisterData *data = opaque;
-    GError *error = NULL;
+    g_autoptr(GError) error = NULL;
 
     for (gsize i = 0; i < data->ndrivers; i += 1) {
         virtDBusConnectNew(&data->connectList[i], connection,
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH] Fix GError memory leaks
Posted by Ján Tomko 6 years ago
On Fri, Apr 20, 2018 at 02:14:43PM +0200, Pavel Hrdina wrote:
>Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>---
> src/gdbus.c | 8 ++++----
> src/main.c  | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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