mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
tests: Fix various minor memory leaks in gdbus-serialization
This commit is contained in:
parent
41acf970ac
commit
c62f7a7d68
@ -511,6 +511,7 @@ get_body_signature (GVariant *value)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If @value is floating, this assumes ownership. */
|
||||||
static void
|
static void
|
||||||
check_serialization (GVariant *value,
|
check_serialization (GVariant *value,
|
||||||
const gchar *expected_dbus_1_output)
|
const gchar *expected_dbus_1_output)
|
||||||
@ -628,6 +629,7 @@ check_serialization (GVariant *value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_object_unref (recovered_message);
|
g_object_unref (recovered_message);
|
||||||
|
g_free (blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (message);
|
g_object_unref (message);
|
||||||
@ -692,6 +694,7 @@ message_serialize_complex (void)
|
|||||||
" dict_entry:\n"
|
" dict_entry:\n"
|
||||||
" string: 'two'\n"
|
" string: 'two'\n"
|
||||||
" string: 'black'\n");
|
" string: 'black'\n");
|
||||||
|
g_variant_unref (value);
|
||||||
|
|
||||||
value = g_variant_parse (G_VARIANT_TYPE ("(sa{sv}as)"),
|
value = g_variant_parse (G_VARIANT_TYPE ("(sa{sv}as)"),
|
||||||
"('01234567890123456', {}, ['Something'])",
|
"('01234567890123456', {}, ['Something'])",
|
||||||
@ -703,6 +706,7 @@ message_serialize_complex (void)
|
|||||||
"value 1: array:\n"
|
"value 1: array:\n"
|
||||||
"value 2: array:\n"
|
"value 2: array:\n"
|
||||||
" string: 'Something'\n");
|
" string: 'Something'\n");
|
||||||
|
g_variant_unref (value);
|
||||||
|
|
||||||
/* https://bugzilla.gnome.org/show_bug.cgi?id=621838 */
|
/* https://bugzilla.gnome.org/show_bug.cgi?id=621838 */
|
||||||
check_serialization (g_variant_new_parsed ("(@aay [], {'cwd': <'/home/davidz/Hacking/glib/gio/tests'>})"),
|
check_serialization (g_variant_new_parsed ("(@aay [], {'cwd': <'/home/davidz/Hacking/glib/gio/tests'>})"),
|
||||||
@ -727,6 +731,7 @@ message_serialize_complex (void)
|
|||||||
"value 1: array:\n"
|
"value 1: array:\n"
|
||||||
" unix-fd: (not extracted)\n"
|
" unix-fd: (not extracted)\n"
|
||||||
" unix-fd: (not extracted)\n");
|
" unix-fd: (not extracted)\n");
|
||||||
|
g_variant_unref (value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,6 +843,7 @@ message_serialize_invalid (void)
|
|||||||
g_assert (message == NULL);
|
g_assert (message == NULL);
|
||||||
|
|
||||||
dbus_free (blob);
|
dbus_free (blob);
|
||||||
|
dbus_message_unref (dbus_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1015,6 +1021,7 @@ message_parse_empty_arrays_of_arrays (void)
|
|||||||
" array:\n"
|
" array:\n"
|
||||||
" array:\n"
|
" array:\n"
|
||||||
" array:\n");
|
" array:\n");
|
||||||
|
g_variant_unref (body);
|
||||||
|
|
||||||
body = g_variant_parse (G_VARIANT_TYPE ("(aaa{uu})"),
|
body = g_variant_parse (G_VARIANT_TYPE ("(aaa{uu})"),
|
||||||
"([@aa{uu} [], [], []],)", NULL, NULL, &error);
|
"([@aa{uu} [], [], []],)", NULL, NULL, &error);
|
||||||
@ -1024,6 +1031,7 @@ message_parse_empty_arrays_of_arrays (void)
|
|||||||
" array:\n"
|
" array:\n"
|
||||||
" array:\n"
|
" array:\n"
|
||||||
" array:\n");
|
" array:\n");
|
||||||
|
g_variant_unref (body);
|
||||||
|
|
||||||
/* Due to the same bug, g_dbus_message_new_from_blob() would fail for this
|
/* Due to the same bug, g_dbus_message_new_from_blob() would fail for this
|
||||||
* message because it would try to read past the end of the string. Hence,
|
* message because it would try to read past the end of the string. Hence,
|
||||||
@ -1044,6 +1052,7 @@ message_parse_empty_arrays_of_arrays (void)
|
|||||||
" struct:\n"
|
" struct:\n"
|
||||||
" array:\n"
|
" array:\n"
|
||||||
" array:\n");
|
" array:\n");
|
||||||
|
g_variant_unref (body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
@ -1075,6 +1084,7 @@ test_double_array (void)
|
|||||||
g_variant_new ("(@ad)", g_variant_builder_end (&builder)),
|
g_variant_new ("(@ad)", g_variant_builder_end (&builder)),
|
||||||
NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, &error);
|
NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, &error);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||||
|
g_error_free (error);
|
||||||
|
|
||||||
g_object_unref (conn);
|
g_object_unref (conn);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user