printers: Fix GVariantIter leaks

This commit is contained in:
Robert Ancell 2019-11-21 21:35:08 +13:00 committed by Robert Ancell
parent 46443af0ca
commit 67074b7aea
3 changed files with 10 additions and 10 deletions

View file

@ -913,7 +913,7 @@ group_physical_devices_dbus_cb (GObject *source_object,
if (array)
{
GVariantIter *iter;
g_autoptr(GVariantIter) iter = NULL;
GStrv device_uris;
result = g_new0 (gchar **, g_variant_n_children (array) + 1);

View file

@ -483,10 +483,9 @@ get_ppd_item_from_output (GVariant *output)
g_variant_get (output, "(@a(ss))", &array);
if (array)
{
GVariantIter *iter;
for (j = 0; j < G_N_ELEMENTS (match_levels) && !ppd_item; j++)
{
g_autoptr(GVariantIter) iter = NULL;
const gchar *driver, *match;
g_variant_get (array, "a(ss)", &iter);
@ -1035,7 +1034,7 @@ get_missing_executables_cb (GObject *source_object,
if (array)
{
GVariantIter *iter;
g_autoptr(GVariantIter) iter = NULL;
const gchar *executable;
g_variant_get (array, "as", &iter);

View file

@ -1934,10 +1934,9 @@ get_ppd_names_async_dbus_scb (GObject *source_object,
if (array)
{
GVariantIter *iter;
for (j = 0; j < G_N_ELEMENTS (match_levels) && n < data->count; j++)
{
g_autoptr(GVariantIter) iter = NULL;
const gchar *driver, *match;
g_variant_get (array,
@ -2163,11 +2162,11 @@ get_device_attributes_async_dbus_cb (GObject *source_object,
if (devices_variant)
{
GVariantIter *iter;
gint index = -1;
if (data->device_uri)
{
g_autoptr(GVariantIter) iter = NULL;
const gchar *key, *value;
g_autofree gchar *suffix = NULL;
@ -3306,7 +3305,7 @@ get_cups_devices_async_dbus_cb (GObject *source_object,
if (devices_variant)
{
GVariantIter *iter;
g_autoptr(GVariantIter) iter = NULL;
const gchar *key, *value;
gint index = -1, max_index = -1, i;
@ -3320,11 +3319,13 @@ get_cups_devices_async_dbus_cb (GObject *source_object,
if (max_index >= 0)
{
g_autoptr(GVariantIter) iter2 = NULL;
num_of_devices = max_index + 1;
devices = g_new0 (PpPrintDevice *, num_of_devices);
g_variant_get (devices_variant, "a{ss}", &iter);
while (g_variant_iter_next (iter, "{&s&s}", &key, &value))
g_variant_get (devices_variant, "a{ss}", &iter2);
while (g_variant_iter_next (iter2, "{&s&s}", &key, &value))
{
index = get_suffix_index (key);
if (index >= 0)