bindings: Avoid iterating array if it is never set

If query.return_type is not one we want, binding_compose_params() is
not called, and so params remains a NULL pointer. However, the code was
then unconditionally iterating it regardless. Don't if it is still NULL.

CID 1452218 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
15. var_deref_op: Dereferencing null pointer params.
This commit is contained in:
Daniel Boles 2017-08-01 20:41:23 +01:00
parent 79bbd4aca5
commit 2b7db2376c

View File

@ -654,9 +654,13 @@ gtk_binding_entry_activate (GtkBindingEntry *entry,
else
handled = TRUE;
for (i = 0; i < query.n_params + 1; i++)
g_value_unset (&params[i]);
g_free (params);
if (params != NULL)
{
for (i = 0; i < query.n_params + 1; i++)
g_value_unset (&params[i]);
g_free (params);
}
if (entry->destroyed)
break;