dis = G_DATA_INPUT_STREAM (g_data_input_stream_new (g_io_stream_get_input_stream (auth->priv->stream)));
dos = G_DATA_OUTPUT_STREAM (g_data_output_stream_new (g_io_stream_get_output_stream (auth->priv->stream)));
+ g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (dis), FALSE);
+ g_filter_output_stream_set_close_base_stream (G_FILTER_OUTPUT_STREAM (dos), FALSE);
g_data_input_stream_set_newline_type (dis, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
g_object_unref (mech);
g_ptr_array_unref (attempted_auth_mechs);
g_strfreev (supported_auth_mechs);
- g_object_ref (dis);
- g_object_ref (dos);
+ g_object_unref (dis);
+ g_object_unref (dos);
/* ensure return value is NULL if error is set */
if (error != NULL && *error != NULL)
dis = G_DATA_INPUT_STREAM (g_data_input_stream_new (g_io_stream_get_input_stream (auth->priv->stream)));
dos = G_DATA_OUTPUT_STREAM (g_data_output_stream_new (g_io_stream_get_output_stream (auth->priv->stream)));
+ g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (dis), FALSE);
+ g_filter_output_stream_set_close_base_stream (G_FILTER_OUTPUT_STREAM (dos), FALSE);
g_data_input_stream_set_newline_type (dis, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
if (mech != NULL)
g_object_unref (mech);
if (dis != NULL)
- g_object_ref (dis);
- if (dis != NULL)
- g_object_ref (dos);
+ g_object_unref (dis);
+ if (dos != NULL)
+ g_object_unref (dos);
/* ensure return value is FALSE if error is set */
if (error != NULL && *error != NULL)
}
/* if just_align==TRUE, don't read a value, just align the input stream wrt padding */
+
+/* returns a non-floating GVariant! */
static GVariant *
parse_value_from_blob (GMemoryInputStream *mis,
GDataInputStream *dis,
goto fail;
}
g_variant_builder_add_value (&builder, item);
+ g_variant_unref (item);
offset = g_seekable_tell (G_SEEKABLE (mis));
}
}
&local_error);
if (key == NULL)
goto fail;
-
value_type = g_variant_type_value (type);
value = parse_value_from_blob (mis,
dis,
goto fail;
}
ret = g_variant_new_dict_entry (key, value);
+ g_variant_unref (key);
+ g_variant_unref (value);
}
}
else if (g_variant_type_is_tuple (type))
goto fail;
}
g_variant_builder_add_value (&builder, item);
+ g_variant_unref (item);
element_type = g_variant_type_next (element_type);
}
if (value == NULL)
goto fail;
ret = g_variant_new_variant (value);
+ g_variant_unref (value);
}
}
else
}
#endif /* DEBUG_SERIALIZER */
+ /* sink the reference */
+ if (ret != NULL)
+ {
+ g_assert (g_variant_is_floating (ret));
+ g_variant_ref_sink (ret);
+ }
return ret;
fail:
error);
if (headers == NULL)
goto out;
- g_variant_ref_sink (headers);
g_variant_iter_init (&iter, headers);
- while ((item = g_variant_iter_next_value (&iter)))
+ while ((item = g_variant_iter_next_value (&iter)) != NULL)
{
guchar header_field;
GVariant *value;
&header_field,
&value);
g_dbus_message_set_header (message, header_field, value);
+ g_variant_unref (value);
+ g_variant_unref (item);
}
g_variant_unref (headers);
FALSE,
2,
error);
- if (message->priv->body == NULL)
- {
- g_variant_type_free (variant_type);
- goto out;
- }
- g_variant_ref_sink (message->priv->body);
g_variant_type_free (variant_type);
+ if (message->priv->body == NULL)
+ goto out;
}
}
else
guint n;
n = 0;
g_variant_iter_init (&iter, value);
- while ((item = g_variant_iter_next_value (&iter)))
+ while ((item = g_variant_iter_next_value (&iter)) != NULL)
{
gsize padding_added_for_item;
if (!append_value_to_blob (item,
dos,
&padding_added_for_item,
error))
- goto fail;
+ {
+ g_variant_unref (item);
+ goto fail;
+ }
+ g_variant_unref (item);
if (n == 0)
{
array_payload_begin_offset += padding_added_for_item;
GVariant *item;
GVariantIter iter;
g_variant_iter_init (&iter, value);
- while ((item = g_variant_iter_next_value (&iter)))
+ while ((item = g_variant_iter_next_value (&iter)) != NULL)
{
if (!append_value_to_blob (item,
g_variant_get_type (item),
dos,
NULL,
error))
- goto fail;
+ {
+ g_variant_unref (item);
+ goto fail;
+ }
+ g_variant_unref (item);
}
}
}
}
g_variant_iter_init (&iter, value);
- while ((item = g_variant_iter_next_value (&iter)))
+ while ((item = g_variant_iter_next_value (&iter)) != NULL)
{
if (!append_value_to_blob (item,
g_variant_get_type (item),
dos,
NULL,
error))
- goto fail;
+ {
+ g_variant_unref (item);
+ goto fail;
+ }
+ g_variant_unref (item);
}
return TRUE;
item = g_variant_get_child_value (message->priv->body, 0);
if (g_variant_is_of_type (item, G_VARIANT_TYPE_STRING))
ret = g_variant_get_string (item, NULL);
+ g_variant_unref (item);
}
return ret;