[libgovirt] resource: Fix leak of OvirtRestCall in async methods



commit 7d3d1d2bdc51a68449b42cf30624b2e4216debb6
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Sep 22 14:00:44 2014 +0200

    resource: Fix leak of OvirtRestCall in async methods
    
    ovirt_rest_call_async() will take its own reference on the call it
    operates on, so ovirt_resource_update_async() and
    ovirt_resource_invoke_action_async() need to drop their reference when
    they no longer need the call they created.

 govirt/ovirt-resource.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index ec79348..35f263b 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -582,6 +582,7 @@ void ovirt_resource_update_async(OvirtResource *resource,
     rest_proxy_call_set_method(REST_PROXY_CALL(call), "PUT");
     ovirt_rest_call_async(OVIRT_REST_CALL(call), result, cancellable,
                           ovirt_resource_update_async_cb, NULL, NULL);
+    g_object_unref(G_OBJECT(call));
 }
 
 
@@ -834,6 +835,7 @@ ovirt_resource_invoke_action_async(OvirtResource *resource,
     ovirt_rest_call_async(OVIRT_REST_CALL(call), result, cancellable,
                           ovirt_resource_invoke_action_async_cb, data,
                           (GDestroyNotify)ovirt_resource_invoke_action_data_free);
+    g_object_unref(G_OBJECT(call));
 }
 
 


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