[cheese/gnome-3-0] cheese-camera: fix 2 gst object reference leaks



commit 74a722daf5e8134859f568032f3c9d66c362b3ce
Author: Raluca Elena Podiuc <ralucaelena1985 gmail com>
Date:   Mon Aug 15 13:07:38 2011 +0300

    cheese-camera: fix 2 gst object reference leaks
    
    Quote from the manual:
      http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html#gst-bin-get-by-name
      GstElement *gst_bin_get_by_name (GstBin *bin, const gchar *name);
      Caller owns returned reference.
    
    We get both colorspace1 and colorspace2 with gst_bin_get_by_name().
    We must unref both before exiting.

 libcheese/cheese-camera.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 6b5a763..a818970 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -679,10 +679,12 @@ cheese_camera_element_from_effect (CheeseCamera *camera, CheeseEffect *effect)
   pad = gst_element_get_static_pad (colorspace1, "sink");
   gst_element_add_pad (effect_filter, gst_ghost_pad_new ("sink", pad));
   gst_object_unref (GST_OBJECT (pad));
+  gst_object_unref (GST_OBJECT (colorspace1));
 
   pad = gst_element_get_static_pad (colorspace2, "src");
   gst_element_add_pad (effect_filter, gst_ghost_pad_new ("src", pad));
   gst_object_unref (GST_OBJECT (pad));
+  gst_object_unref (GST_OBJECT (colorspace2));
 
   return effect_filter;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]