Fix a serious leak in tee

Original commit message from CVS:
Fix a serious leak in tee
This commit is contained in:
Wim Taymans 2002-02-02 00:22:34 +00:00
parent 5684e131de
commit b37f73757a
2 changed files with 16 additions and 8 deletions

View file

@ -115,7 +115,7 @@ gst_tee_class_init (GstTeeClass *klass)
gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_tee_request_new_pad);
}
static gboolean
static GstPadConnectReturn
gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstTee *tee;
@ -123,6 +123,10 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
tee = GST_TEE (gst_pad_get_parent (pad));
if (!GST_CAPS_IS_FIXED (caps)) {
return GST_PAD_CONNECT_DELAYED;
}
/* go through all the src pads */
pads = gst_element_get_pad_list (GST_ELEMENT (tee));
@ -134,10 +138,10 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
continue;
if (!(gst_pad_try_set_caps (outpad, caps))) {
return FALSE;
return GST_PAD_CONNECT_REFUSED;
}
}
return TRUE;
return GST_PAD_CONNECT_OK;
}
static void
@ -261,7 +265,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
tee = GST_TEE (gst_pad_get_parent (pad));
/* gst_trace_add_entry (NULL, 0, buf, "tee buffer");*/
gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads);
gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads - 1);
pads = gst_element_get_pad_list (GST_ELEMENT (tee));

View file

@ -115,7 +115,7 @@ gst_tee_class_init (GstTeeClass *klass)
gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_tee_request_new_pad);
}
static gboolean
static GstPadConnectReturn
gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstTee *tee;
@ -123,6 +123,10 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
tee = GST_TEE (gst_pad_get_parent (pad));
if (!GST_CAPS_IS_FIXED (caps)) {
return GST_PAD_CONNECT_DELAYED;
}
/* go through all the src pads */
pads = gst_element_get_pad_list (GST_ELEMENT (tee));
@ -134,10 +138,10 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
continue;
if (!(gst_pad_try_set_caps (outpad, caps))) {
return FALSE;
return GST_PAD_CONNECT_REFUSED;
}
}
return TRUE;
return GST_PAD_CONNECT_OK;
}
static void
@ -261,7 +265,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
tee = GST_TEE (gst_pad_get_parent (pad));
/* gst_trace_add_entry (NULL, 0, buf, "tee buffer");*/
gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads);
gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads - 1);
pads = gst_element_get_pad_list (GST_ELEMENT (tee));