interlace: fix caps leaks

This commit is contained in:
Vincent Penquerc'h 2012-01-10 13:25:05 +00:00
parent 5ea1601dd9
commit 6cf84a0348

View File

@ -187,6 +187,7 @@ static gboolean gst_interlace_setcaps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_interlace_getcaps (GstPad * pad); static GstCaps *gst_interlace_getcaps (GstPad * pad);
static GstStateChangeReturn gst_interlace_change_state (GstElement * element, static GstStateChangeReturn gst_interlace_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static void gst_interlace_finalize (GObject * obj);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -242,6 +243,7 @@ gst_interlace_class_init (GstInterlaceClass * klass)
object_class->set_property = gst_interlace_set_property; object_class->set_property = gst_interlace_set_property;
object_class->get_property = gst_interlace_get_property; object_class->get_property = gst_interlace_get_property;
object_class->finalize = gst_interlace_finalize;
element_class->change_state = gst_interlace_change_state; element_class->change_state = gst_interlace_change_state;
@ -268,6 +270,16 @@ gst_interlace_class_init (GstInterlaceClass * klass)
} }
static void
gst_interlace_finalize (GObject * obj)
{
GstInterlace *interlace = GST_INTERLACE (obj);
gst_caps_replace (&interlace->srccaps, NULL);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void static void
gst_interlace_reset (GstInterlace * interlace) gst_interlace_reset (GstInterlace * interlace)
{ {
@ -478,7 +490,7 @@ gst_interlace_setcaps (GstPad * pad, GstCaps * caps)
gboolean interlaced = TRUE; gboolean interlaced = TRUE;
int fps_n, fps_d; int fps_n, fps_d;
GstPad *otherpad; GstPad *otherpad;
GstCaps *othercaps; GstCaps *othercaps = NULL;
const PulldownFormat *pdformat; const PulldownFormat *pdformat;
interlace = GST_INTERLACE (gst_pad_get_parent (pad)); interlace = GST_INTERLACE (gst_pad_get_parent (pad));
@ -527,6 +539,8 @@ gst_interlace_setcaps (GstPad * pad, GstCaps * caps)
} }
error: error:
if (othercaps)
gst_caps_unref (othercaps);
g_object_unref (interlace); g_object_unref (interlace);
return ret; return ret;