summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/devices/wifi/nm-device-wifi.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index f4413029ec..f334858cb4 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -1074,10 +1074,9 @@ _hw_addr_set_scanning (NMDeviceWifi *self, gboolean do_reset)
static GPtrArray *
ssids_options_to_ptrarray (GVariant *value, GError **error)
{
- GPtrArray *ssids = NULL;
- const guint8 *bytes;
- gsize len;
- int num_ssids, i;
+ gs_unref_ptrarray GPtrArray *ssids = NULL;
+ gsize num_ssids;
+ gsize i;
nm_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("aay")));
@@ -1094,6 +1093,8 @@ ssids_options_to_ptrarray (GVariant *value, GError **error)
ssids = g_ptr_array_new_full (num_ssids, (GDestroyNotify) g_bytes_unref);
for (i = 0; i < num_ssids; i++) {
gs_unref_variant GVariant *v = NULL;
+ gsize len;
+ const guint8 *bytes;
v = g_variant_get_child_value (value, i);
bytes = g_variant_get_fixed_array (v, &len, sizeof (guint8));
@@ -1101,15 +1102,15 @@ ssids_options_to_ptrarray (GVariant *value, GError **error)
g_set_error (error,
NM_DEVICE_ERROR,
NM_DEVICE_ERROR_NOT_ALLOWED,
- "SSID at index %d more than 32 bytes", i);
- g_ptr_array_unref (ssids);
+ "SSID at index %d more than 32 bytes", (int) i);
return NULL;
}
g_ptr_array_add (ssids, g_bytes_new (bytes, len));
}
}
- return ssids;
+
+ return g_steal_pointer (&ssids);
}
GPtrArray *