mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-24 02:47:52 +02:00
gobject: Add a missing NULL check for the return from lookup_type_node_I()
This can cause a `NULL` dereference on the next line if there is no `TypeNode` for `iface_type`, for example if `iface_type == G_TYPE_INVALID`. Unlikely, but possible since this API is public. Spotted by Coverity. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Coverity CID: #1501602
This commit is contained in:
@@ -130,6 +130,8 @@ test_type_flags_final_instance_check (void)
|
||||
TEST_TYPE_DEPRECATED));
|
||||
g_assert_true (g_type_check_instance_is_a ((GTypeInstance *) final,
|
||||
G_TYPE_OBJECT));
|
||||
g_assert_false (g_type_check_instance_is_a ((GTypeInstance *) final,
|
||||
G_TYPE_INVALID));
|
||||
|
||||
g_clear_object (&final);
|
||||
}
|
||||
@@ -184,6 +186,8 @@ test_type_flags_deprecated (void)
|
||||
G_TYPE_OBJECT));
|
||||
g_assert_false (g_type_check_instance_is_a ((GTypeInstance *) deprecated_object,
|
||||
TEST_TYPE_FINAL));
|
||||
g_assert_false (g_type_check_instance_is_a ((GTypeInstance *) deprecated_object,
|
||||
G_TYPE_INVALID));
|
||||
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
|
Reference in New Issue
Block a user