summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2014-10-13 15:58:56 +0100
committerTim-Philipp Müller <tim@centricular.com>2014-10-14 16:54:44 +0100
commitd0aa9f9a344980939e9064400a381a2e145cc08d (patch)
treebe8079d7bcdccf8fea564b1d24e65542a487077d
parent2f60c9c4fe5c3d767f7e862fe53edca69e25d54e (diff)
encodebin: fix some leaks in error code path
Fixes test_encodebin_sink_pads_nopreset_static running under valgrind.
-rw-r--r--gst/encoding/gstencodebin.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c
index d1ce16954..3a8860354 100644
--- a/gst/encoding/gstencodebin.c
+++ b/gst/encoding/gstencodebin.c
@@ -317,6 +317,7 @@ static gboolean gst_encode_bin_setup_profile (GstEncodeBin * ebin,
static StreamGroup *_create_stream_group (GstEncodeBin * ebin,
GstEncodingProfile * sprof, const gchar * sinkpadname, GstCaps * sinkcaps);
static void stream_group_remove (GstEncodeBin * ebin, StreamGroup * sgroup);
+static void stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup);
static GstPad *gst_encode_bin_request_pad_signal (GstEncodeBin * encodebin,
GstCaps * caps);
static GstPad *gst_encode_bin_request_profile_pad_signal (GstEncodeBin *
@@ -1585,7 +1586,8 @@ cleanup:
gst_caps_unref (format);
if (restriction)
gst_caps_unref (restriction);
- g_slice_free (StreamGroup, sgroup);
+ stream_group_free (ebin, sgroup);
+ g_list_free (tosync);
return NULL;
}
@@ -1920,7 +1922,7 @@ release_pads (const GValue * item, GstElement * elt)
gst_element_release_request_pad (elt, pad);
}
-static void inline
+static void
stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
{
GList *tmp;
@@ -1929,7 +1931,8 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
GST_DEBUG_OBJECT (ebin, "Freeing StreamGroup %p", sgroup);
- g_signal_handler_disconnect (sgroup->profile, sgroup->restriction_sid);
+ if (sgroup->restriction_sid != 0)
+ g_signal_handler_disconnect (sgroup->profile, sgroup->restriction_sid);
if (ebin->muxer) {
/* outqueue - Muxer */
@@ -1972,8 +1975,12 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
}
/* Sink Ghostpad */
- if (sgroup->ghostpad)
- gst_element_remove_pad (GST_ELEMENT_CAST (ebin), sgroup->ghostpad);
+ if (sgroup->ghostpad) {
+ if (GST_PAD_PARENT (sgroup->ghostpad) != NULL)
+ gst_element_remove_pad (GST_ELEMENT_CAST (ebin), sgroup->ghostpad);
+ else
+ gst_object_unref (sgroup->ghostpad);
+ }
if (sgroup->inqueue)
gst_element_set_state (sgroup->inqueue, GST_STATE_NULL);