gboxed: Fix two potential NULL pointer dereferences

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 <withnall@endlessm.com>

Helps: #1767
This commit is contained in:
Philip Withnall 2019-09-05 14:16:11 +01:00
parent 8fe58ffe12
commit 8f52d2cb02

View File

@ -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)