summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-client.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-01-26 12:17:57 +0100
committerThomas Haller <thaller@redhat.com>2016-01-26 12:20:15 +0100
commit25465cdbf1e3c34231a8bb4b3806d4622179ae46 (patch)
tree72799917315d215dc891cbf8067c2188e4f7b4d4 /libnm-glib/nm-client.c
parent620243fb5e40f43e289ccd5859e84b104aa4ae10 (diff)
libnm-glib: fix another memory leak around update_permissions()
This time in init_async_got_permissions(). Thereby, just use gs_unref_hash and gs_free_error for cleanup.
Diffstat (limited to 'libnm-glib/nm-client.c')
-rw-r--r--libnm-glib/nm-client.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index 468b06d2d..34c8bb377 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -36,6 +36,7 @@
#include "nm-vpn-connection.h"
#include "nm-object-cache.h"
#include "nm-dbus-glib-types.h"
+#include "gsystem-local-alloc.h"
void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled);
@@ -317,16 +318,13 @@ static gboolean
get_permissions_sync (NMClient *self, GError **error)
{
gboolean success;
- GHashTable *permissions = NULL;
+ gs_unref_hashtable GHashTable *permissions = NULL;
success = dbus_g_proxy_call_with_timeout (NM_CLIENT_GET_PRIVATE (self)->client_proxy,
"GetPermissions", 3000, error,
G_TYPE_INVALID,
DBUS_TYPE_G_MAP_OF_STRING, &permissions, G_TYPE_INVALID);
update_permissions (self, success ? permissions : NULL);
- if (permissions)
- g_hash_table_destroy (permissions);
-
return success;
}
@@ -336,17 +334,14 @@ get_permissions_reply (DBusGProxy *proxy,
gpointer user_data)
{
NMClient *self = NM_CLIENT (user_data);
- GHashTable *permissions = NULL;
- GError *error = NULL;
+ gs_unref_hashtable GHashTable *permissions = NULL;
+ gs_free_error GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error,
DBUS_TYPE_G_MAP_OF_STRING, &permissions,
G_TYPE_INVALID);
NM_CLIENT_GET_PRIVATE (self)->perm_call = NULL;
update_permissions (NM_CLIENT (user_data), error ? NULL : permissions);
- if (permissions)
- g_hash_table_destroy (permissions);
- g_clear_error (&error);
}
static void
@@ -1932,14 +1927,13 @@ static void
init_async_got_permissions (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
NMClientInitData *init_data = user_data;
- GHashTable *permissions;
- GError *error = NULL;
+ gs_unref_hashtable GHashTable *permissions = NULL;
+ gs_free_error GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error,
DBUS_TYPE_G_MAP_OF_STRING, &permissions,
G_TYPE_INVALID);
update_permissions (init_data->client, error ? NULL : permissions);
- g_clear_error (&error);
init_data->permissions_pending = FALSE;
init_async_complete (init_data);