sys: fix some bufferpool leaks
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 18 Jun 2012 10:17:12 +0000 (12:17 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 18 Jun 2012 10:17:25 +0000 (12:17 +0200)
sys/ximage/ximagesink.c
sys/xvimage/xvimagesink.c

index a1e9bf0..f47e7d3 100644 (file)
@@ -1459,12 +1459,12 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
   if (pool == NULL && need_pool) {
     GstVideoInfo info;
 
-    GST_DEBUG_OBJECT (ximagesink, "create new pool");
-    pool = gst_ximage_buffer_pool_new (ximagesink);
-
     if (!gst_video_info_from_caps (&info, caps))
       goto invalid_caps;
 
+    GST_DEBUG_OBJECT (ximagesink, "create new pool");
+    pool = gst_ximage_buffer_pool_new (ximagesink);
+
     /* the normal size of a frame */
     size = info.size;
 
@@ -1499,6 +1499,7 @@ invalid_caps:
 config_failed:
   {
     GST_DEBUG_OBJECT (bsink, "failed setting config");
+    gst_object_unref (pool);
     return FALSE;
   }
 }
index 087ab54..ed2f10c 100644 (file)
@@ -1970,12 +1970,12 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
   if (pool == NULL && need_pool) {
     GstVideoInfo info;
 
-    GST_DEBUG_OBJECT (xvimagesink, "create new pool");
-    pool = gst_xvimage_buffer_pool_new (xvimagesink);
-
     if (!gst_video_info_from_caps (&info, caps))
       goto invalid_caps;
 
+    GST_DEBUG_OBJECT (xvimagesink, "create new pool");
+    pool = gst_xvimage_buffer_pool_new (xvimagesink);
+
     /* the normal size of a frame */
     size = info.size;
 
@@ -2010,6 +2010,7 @@ invalid_caps:
 config_failed:
   {
     GST_DEBUG_OBJECT (bsink, "failed setting config");
+    gst_object_unref (pool);
     return FALSE;
   }
 }