xvimagesink: fix navigation event leak when early returning
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 4 May 2015 15:59:30 +0000 (17:59 +0200)
committerThiago Santos <thiagoss@osg.samsung.com>
Tue, 5 May 2015 16:54:08 +0000 (13:54 -0300)
Create the event *after* the early return check so it's not leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=748903

sys/xvimage/xvimagesink.c

index 6112545..e8752d3 100644 (file)
@@ -1137,8 +1137,6 @@ gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
     gdouble x, y, xscale = 1.0, yscale = 1.0;
     GstXWindow *xwindow;
 
-    event = gst_event_new_navigation (structure);
-
     /* We take the flow_lock while we look at the window */
     g_mutex_lock (&xvimagesink->flow_lock);
 
@@ -1183,6 +1181,7 @@ gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
           (gdouble) y * yscale, NULL);
     }
 
+    event = gst_event_new_navigation (structure);
     gst_event_ref (event);
     handled = gst_pad_send_event (peer, event);
     gst_object_unref (peer);