[glib/glib-2-70: 16/18] gtype: Fix pointer being dereferenced despite NULL check
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-70: 16/18] gtype: Fix pointer being dereferenced despite NULL check
- Date: Tue, 19 Oct 2021 06:21:26 +0000 (UTC)
commit c590938ba90fda633fbb7633c11ac65c4c939760
Author: Egor Bychin <e bychin drweb com>
Date: Mon Oct 11 14:26:20 2021 +0300
gtype: Fix pointer being dereferenced despite NULL check
gobject/gtype.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 34f62ecba..26ec30b7b 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -3159,11 +3159,14 @@ g_type_class_peek_parent (gpointer g_class)
g_return_val_if_fail (g_class != NULL, NULL);
node = lookup_type_node_I (G_TYPE_FROM_CLASS (g_class));
+
+ g_return_val_if_fail (node != NULL, NULL);
+
/* We used to acquire a read lock here. That is not necessary, since
* parent->data->class.class is constant as long as the derived class
* exists.
*/
- if (node && node->is_classed && node->data && NODE_PARENT_TYPE (node))
+ if (node->is_classed && node->data && NODE_PARENT_TYPE (node))
{
node = lookup_type_node_I (NODE_PARENT_TYPE (node));
class = node->data->class.class;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]