From 8f52d2cb022a2bce6ade375db45f162123552ace Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 5 Sep 2019 14:16:11 +0100 Subject: [PATCH] gboxed: Fix two potential NULL pointer dereferences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don’t think these could be hit in practice due to the guarantees of the type system, but the static analyser doesn’t know that — so make the assertions clearer to shut it up. Signed-off-by: Philip Withnall Helps: #1767 --- gobject/gboxed.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 4404de3d6..87cc5d2c2 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -346,8 +346,7 @@ g_boxed_copy (GType boxed_type, g_return_val_if_fail (src_boxed != NULL, NULL); value_table = g_type_value_table_peek (boxed_type); - if (!value_table) - g_return_val_if_fail (G_TYPE_IS_VALUE_TYPE (boxed_type), NULL); + g_assert (value_table != NULL); /* check if our proxying implementation is used, we can short-cut here */ if (value_table->value_copy == boxed_proxy_value_copy) @@ -404,8 +403,7 @@ g_boxed_free (GType boxed_type, g_return_if_fail (boxed != NULL); value_table = g_type_value_table_peek (boxed_type); - if (!value_table) - g_return_if_fail (G_TYPE_IS_VALUE_TYPE (boxed_type)); + g_assert (value_table != NULL); /* check if our proxying implementation is used, we can short-cut here */ if (value_table->value_free == boxed_proxy_value_free)