[gtk+/gtk-3-22] bindings: Avoid iterating array if it is never set
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] bindings: Avoid iterating array if it is never set
- Date: Tue, 1 Aug 2017 19:47:31 +0000 (UTC)
commit 7dd33497518e98806216c140728ad2a7114fb015
Author: Daniel Boles <dboles src gnome org>
Date: Tue Aug 1 20:41:23 2017 +0100
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.
gtk/gtkbindings.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index a06a050..653bc31 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -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 (¶ms[i]);
- g_free (params);
+ if (params != NULL)
+ {
+ for (i = 0; i < query.n_params + 1; i++)
+ g_value_unset (¶ms[i]);
+
+ g_free (params);
+ }
if (entry->destroyed)
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]