mpegtsmux: guard against _dispose being called mutiple times

_dispose calls _reset, so we need to make sure _reset handles
already NULLed fields.

Coverity 1139843
This commit is contained in:
Vincent Penquerc'h 2014-04-09 13:51:41 +01:00
parent d6dc066527
commit d47727c032

View file

@ -388,8 +388,10 @@ mpegtsmux_reset (MpegTsMux * mux, gboolean alloc)
mux->element_index = NULL;
}
#endif
gst_adapter_clear (mux->adapter);
gst_adapter_clear (mux->out_adapter);
if (mux->adapter)
gst_adapter_clear (mux->adapter);
if (mux->out_adapter)
gst_adapter_clear (mux->out_adapter);
if (mux->tsmux) {
tsmux_free (mux->tsmux);
@ -414,10 +416,12 @@ mpegtsmux_reset (MpegTsMux * mux, gboolean alloc)
gst_event_replace (&mux->force_key_unit_event, NULL);
gst_buffer_replace (&mux->out_buffer, NULL);
GST_COLLECT_PADS_STREAM_LOCK (mux->collect);
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk))
mpegtsmux_pad_reset ((MpegTsPadData *) walk->data);
GST_COLLECT_PADS_STREAM_UNLOCK (mux->collect);
if (mux->collect) {
GST_COLLECT_PADS_STREAM_LOCK (mux->collect);
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk))
mpegtsmux_pad_reset ((MpegTsPadData *) walk->data);
GST_COLLECT_PADS_STREAM_UNLOCK (mux->collect);
}
if (alloc) {
mux->tsmux = tsmux_new ();