diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2022-12-21 19:16:10 +0000 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2022-12-21 19:16:10 +0000 |
commit | 251bab3e719857b6bd1e9ad5c6ab37c26a22a3ba (patch) | |
tree | 16177185d4f01b7a735c0f944d2a960f82417c17 /gobject/gtype.c | |
parent | 5e378c775a79b61f307f2b780652745b528b4105 (diff) | |
download | glib-251bab3e719857b6bd1e9ad5c6ab37c26a22a3ba.tar.gz |
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
Diffstat (limited to 'gobject/gtype.c')
-rw-r--r-- | gobject/gtype.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gobject/gtype.c b/gobject/gtype.c index 77feb7d4a..8665db294 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -4161,7 +4161,7 @@ g_type_check_instance_is_a (GTypeInstance *type_instance, return FALSE; iface = lookup_type_node_I (iface_type); - if (iface->is_final) + if (iface && iface->is_final) return type_instance->g_class->g_type == iface_type; node = lookup_type_node_I (type_instance->g_class->g_type); |