ext/ogg/gstoggdemux.c: The chain should be freed if we error out here, else it will leak.

Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_find_chains):
The chain should be freed if we error out here, else it will leak.
* gst/playback/gstdecodebin.c: (disconnect_unlinked_signals),
(cleanup_decodebin):
Don't forget to *properly* remove the signals, else it will leak.
This commit is contained in:
Edward Hervey 2007-06-23 14:44:07 +00:00
parent dd65a6d76e
commit fa877be84c
3 changed files with 41 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2007-06-23 Edward Hervey <edward@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_find_chains):
The chain should be freed if we error out here, else it will leak.
* gst/playback/gstdecodebin.c: (disconnect_unlinked_signals),
(cleanup_decodebin):
Don't forget to *properly* remove the signals, else it will leak.
2007-06-22 Jan Schmidt <thaytan@noraisin.net> 2007-06-22 Jan Schmidt <thaytan@noraisin.net>
* MAINTAINERS: * MAINTAINERS:

View file

@ -2712,6 +2712,8 @@ no_first_chain:
no_last_page: no_last_page:
{ {
GST_DEBUG_OBJECT (ogg, "can't get last page"); GST_DEBUG_OBJECT (ogg, "can't get last page");
if (chain)
gst_ogg_chain_free (chain);
return ret; return ret;
} }
} }

View file

@ -1575,6 +1575,34 @@ shutting_down:
return; return;
} }
static void
disconnect_unlinked_signals (GstDecodeBin * decode_bin, GstElement * element)
{
GstIterator *pad_it = NULL;
gboolean done = FALSE;
pad_it = gst_element_iterate_src_pads (element);
while (!done) {
GstPad *pad = NULL;
switch (gst_iterator_next (pad_it, (gpointer) & pad)) {
case GST_ITERATOR_OK:
g_signal_handlers_disconnect_by_func (pad, (gpointer) unlinked,
decode_bin);
gst_object_unref (pad);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (pad_it);
break;
default:
done = TRUE;
break;
}
}
gst_iterator_free (pad_it);
}
static void static void
cleanup_decodebin (GstDecodeBin * decode_bin) cleanup_decodebin (GstDecodeBin * decode_bin)
{ {
@ -1600,8 +1628,7 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
case GST_ITERATOR_OK: case GST_ITERATOR_OK:
if (element != decode_bin->typefind && element != decode_bin->fakesink) { if (element != decode_bin->typefind && element != decode_bin->fakesink) {
GST_DEBUG_OBJECT (element, "removing autoplugged element"); GST_DEBUG_OBJECT (element, "removing autoplugged element");
g_signal_handlers_disconnect_by_func (element, (gpointer) unlinked, disconnect_unlinked_signals (decode_bin, element);
decode_bin);
gst_element_set_state (element, GST_STATE_NULL); gst_element_set_state (element, GST_STATE_NULL);
gst_bin_remove (GST_BIN (decode_bin), element); gst_bin_remove (GST_BIN (decode_bin), element);
} }
@ -1651,6 +1678,8 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
if (GST_IS_PAD (typefind_pad)) { if (GST_IS_PAD (typefind_pad)) {
g_signal_handlers_unblock_by_func (typefind_pad, (gpointer) unlinked, g_signal_handlers_unblock_by_func (typefind_pad, (gpointer) unlinked,
decode_bin); decode_bin);
g_signal_handlers_disconnect_by_func (typefind_pad, (gpointer) unlinked,
decode_bin);
gst_object_unref (typefind_pad); gst_object_unref (typefind_pad);
} }
} }