tests: fix warning and memory leak in stress-overlay test
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 26 Dec 2009 23:29:24 +0000 (23:29 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 26 Dec 2009 23:29:24 +0000 (23:29 +0000)
Not all messages have structures and we need to unref messages
when returning GST_BUS_DROP in the sync bus handler.

tests/icles/stress-xoverlay.c

index 41a6c92..4a7a3c7 100644 (file)
@@ -146,7 +146,7 @@ create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
   GstXOverlay *ov = NULL;
 
   s = gst_message_get_structure (message);
-  if (!gst_structure_has_name (s, "prepare-xwindow-id")) {
+  if (s == NULL || !gst_structure_has_name (s, "prepare-xwindow-id")) {
     return GST_BUS_PASS;
   }
 
@@ -161,6 +161,7 @@ create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
   g_timeout_add (100, (GSourceFunc) cycle_window, ov);
   g_timeout_add (2000, (GSourceFunc) toggle_events, ov);
 
+  gst_message_unref (message);
   return GST_BUS_DROP;
 }