[libgovirt] Fix memory handling of 'call' in ovirt_rest_call_async() calls
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] Fix memory handling of 'call' in ovirt_rest_call_async() calls
- Date: Wed, 16 Apr 2014 16:21:16 +0000 (UTC)
commit 6ef922a19d78292ec066c96277c554284386418e
Author: Christophe Fergeau <cfergeau redhat com>
Date: Wed Apr 16 18:16:17 2014 +0200
Fix memory handling of 'call' in ovirt_rest_call_async() calls
ovirt_rest_call_async() will end up calling rest_proxy_call_async()
which takes a reference on its RestProxyCall argument so we can
drop ours after calling ovirt_rest_call_async()
This fixes a memory leak reported by valgrind.
govirt/ovirt-cdrom.c | 1 +
govirt/ovirt-proxy.c | 1 -
govirt/ovirt-vm.c | 1 +
3 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/govirt/ovirt-cdrom.c b/govirt/ovirt-cdrom.c
index cc10bd5..31ded13 100644
--- a/govirt/ovirt-cdrom.c
+++ b/govirt/ovirt-cdrom.c
@@ -232,6 +232,7 @@ void ovirt_cdrom_update_async(OvirtCdrom *cdrom,
}
ovirt_rest_call_async(OVIRT_REST_CALL(call), result, cancellable,
NULL, NULL, NULL);
+ g_object_unref(G_OBJECT(call));
}
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index b4ee32f..a44f78c 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -287,7 +287,6 @@ void ovirt_rest_call_async(OvirtRestCall *call,
g_warning("Error while getting collection XML");
g_simple_async_result_set_from_error(result, error);
g_simple_async_result_complete(result);
- g_object_unref(G_OBJECT(call));
ovirt_proxy_call_async_data_free(data);
}
}
diff --git a/govirt/ovirt-vm.c b/govirt/ovirt-vm.c
index 07be61b..743b894 100644
--- a/govirt/ovirt-vm.c
+++ b/govirt/ovirt-vm.c
@@ -329,6 +329,7 @@ void ovirt_vm_refresh_async(OvirtVm *vm, OvirtProxy *proxy,
call = ovirt_rest_call_new(proxy, "GET", href);
ovirt_rest_call_async(call, result, cancellable,
ovirt_vm_refresh_async_cb, vm, NULL);
+ g_object_unref(G_OBJECT(call));
g_free(href);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]