From 666807ed695be260befcba15638ef53789d9650d Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Tue, 12 Jul 2011 01:18:16 +0530 Subject: [PATCH] mpegtsmux: fix segfault if gst_collect_pads_pop () returns no buffer In mpegtsmux_choose_best_stream () call if the gst_collect_pads_pop () call returns no buffer (NULL), the plugin SegFaults in the gst_buffer_unref call. To fix this we check if a valid buffer is returned before calling gst_buffer_unref (). Fixes bug #654416. --- gst/mpegtsmux/mpegtsmux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 6ba24ec987..606e1d7f3a 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -642,7 +642,9 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux) } } if (c_best) { - gst_buffer_unref (gst_collect_pads_pop (mux->collect, c_best)); + GstBuffer *buffer; + if ((buffer = gst_collect_pads_pop (mux->collect, c_best))) + gst_buffer_unref (buffer); } return best;