[FFmpeg-cvslog] mpegts: add the judgement if a new program is created successfully

Di Wu git at videolan.org
Thu Oct 16 04:22:54 CEST 2014


ffmpeg | branch: master | Di Wu <di1028.wu at samsung.com> | Wed Oct 15 16:24:21 2014 +0800| [0e406aba14a89e94b31afde02b6bc0f456b113f5] | committer: Michael Niedermayer

mpegts: add the judgement if a new program is created successfully

Add the judement after create a new program to avoid segment fault.

Signed-off-by: Di Wu <di1028.wu at samsung.com>
Reviewed-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e406aba14a89e94b31afde02b6bc0f456b113f5
---

 libavformat/mpegts.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 8808269..cc0ce79 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1925,8 +1925,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         } else {
             MpegTSFilter *fil = ts->pids[pmt_pid];
             program = av_new_program(ts->stream, sid);
-            program->program_num = sid;
-            program->pmt_pid = pmt_pid;
+            if (program) {
+                program->program_num = sid;
+                program->pmt_pid = pmt_pid;
+            }
             if (fil)
                 if (   fil->type != MPEGTS_SECTION
                     || fil->pid != pmt_pid



More information about the ffmpeg-cvslog mailing list