diff options
author | Debarshi Ray <debarshir@gnome.org> | 2017-10-18 16:44:33 +0200 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2017-10-19 10:03:46 +0200 |
commit | 7ee0e65631c5d9afb589f3e7aa25d8bdf83c85c3 (patch) | |
tree | e16fcda477cdce09bd9bb5737e28b873838c55eb /gtk/gtkgesturezoom.c | |
parent | 82e33823a91bc2a24f5c7e88de37587ad595bb4d (diff) | |
download | gtk+-7ee0e65631c5d9afb589f3e7aa25d8bdf83c85c3.tar.gz |
GtkGestureZoom: Don't leak the list of sequences
https://bugzilla.gnome.org/show_bug.cgi?id=789149
Diffstat (limited to 'gtk/gtkgesturezoom.c')
-rw-r--r-- | gtk/gtkgesturezoom.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gtk/gtkgesturezoom.c b/gtk/gtkgesturezoom.c index 905e6ab29f..0af650532b 100644 --- a/gtk/gtkgesturezoom.c +++ b/gtk/gtkgesturezoom.c @@ -79,18 +79,19 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom, const GdkEvent *last_event; gdouble x1, y1, x2, y2; GtkGesture *gesture; - GList *sequences; + GList *sequences = NULL; gdouble dx, dy; GdkTouchpadGesturePhase phase; + gboolean retval = FALSE; gesture = GTK_GESTURE (zoom); if (!gtk_gesture_is_recognized (gesture)) - return FALSE; + goto out; sequences = gtk_gesture_get_sequences (gesture); if (!sequences) - return FALSE; + goto out; last_event = gtk_gesture_get_last_event (gesture, sequences->data); gdk_event_get_touchpad_gesture_phase (last_event, &phase); @@ -109,18 +110,21 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom, else { if (!sequences->next) - return FALSE; + goto out; gtk_gesture_get_point (gesture, sequences->data, &x1, &y1); gtk_gesture_get_point (gesture, sequences->next->data, &x2, &y2); - g_list_free (sequences); dx = x1 - x2; dy = y1 - y2;; *distance = sqrt ((dx * dx) + (dy * dy)); } - return TRUE; + retval = TRUE; + + out: + g_list_free (sequences); + return retval; } static gboolean |