libavformat/mpegtsenc.c:466: error: Null Dereference
  pointer `pcr_st` last assigned on line 388 could be null and is dereferenced at line 466, column 13.

libavformat/mpegtsenc.c:383:1: start of procedure mpegts_write_header()
381. }
382. 
383. static int mpegts_write_header(AVFormatContext *s)
     ^
384. {
385.     MpegTSWrite *ts = s->priv_data;

libavformat/mpegtsenc.c:385:5: 
383. static int mpegts_write_header(AVFormatContext *s)
384. {
385.     MpegTSWrite *ts = s->priv_data;
         ^
386.     MpegTSWriteStream *ts_st;
387.     MpegTSService *service;

libavformat/mpegtsenc.c:388:5: 
386.     MpegTSWriteStream *ts_st;
387.     MpegTSService *service;
388.     AVStream *st, *pcr_st = NULL;
         ^
389.     AVMetadataTag *title;
390.     int i;

libavformat/mpegtsenc.c:393:5: 
391.     const char *service_name;
392. 
393.     ts->tsid = DEFAULT_TSID;
         ^
394.     ts->onid = DEFAULT_ONID;
395.     /* allocate a single DVB service */

libavformat/mpegtsenc.c:394:5: 
392. 
393.     ts->tsid = DEFAULT_TSID;
394.     ts->onid = DEFAULT_ONID;
         ^
395.     /* allocate a single DVB service */
396.     title = av_metadata_get(s->metadata, "title", NULL, 0);

libavformat/mpegtsenc.c:396:5: Skipping av_metadata_get(): empty list of specs
394.     ts->onid = DEFAULT_ONID;
395.     /* allocate a single DVB service */
396.     title = av_metadata_get(s->metadata, "title", NULL, 0);
         ^
397.     service_name = title ? title->value : DEFAULT_SERVICE_NAME;
398.     service = mpegts_add_service(ts, DEFAULT_SID,

libavformat/mpegtsenc.c:397:20: Condition is false
395.     /* allocate a single DVB service */
396.     title = av_metadata_get(s->metadata, "title", NULL, 0);
397.     service_name = title ? title->value : DEFAULT_SERVICE_NAME;
                        ^
398.     service = mpegts_add_service(ts, DEFAULT_SID,
399.                                  DEFAULT_PROVIDER_NAME, service_name);

libavformat/mpegtsenc.c:397:5: 
395.     /* allocate a single DVB service */
396.     title = av_metadata_get(s->metadata, "title", NULL, 0);
397.     service_name = title ? title->value : DEFAULT_SERVICE_NAME;
         ^
398.     service = mpegts_add_service(ts, DEFAULT_SID,
399.                                  DEFAULT_PROVIDER_NAME, service_name);

libavformat/mpegtsenc.c:398:5: Skipping mpegts_add_service(): empty list of specs
396.     title = av_metadata_get(s->metadata, "title", NULL, 0);
397.     service_name = title ? title->value : DEFAULT_SERVICE_NAME;
398.     service = mpegts_add_service(ts, DEFAULT_SID,
         ^
399.                                  DEFAULT_PROVIDER_NAME, service_name);
400.     service->pmt.write_packet = section_write_packet;

libavformat/mpegtsenc.c:400:5: 
398.     service = mpegts_add_service(ts, DEFAULT_SID,
399.                                  DEFAULT_PROVIDER_NAME, service_name);
400.     service->pmt.write_packet = section_write_packet;
         ^
401.     service->pmt.opaque = s;
402.     service->pmt.cc = 15;

libavformat/mpegtsenc.c:401:5: 
399.                                  DEFAULT_PROVIDER_NAME, service_name);
400.     service->pmt.write_packet = section_write_packet;
401.     service->pmt.opaque = s;
         ^
402.     service->pmt.cc = 15;
403. 

libavformat/mpegtsenc.c:402:5: 
400.     service->pmt.write_packet = section_write_packet;
401.     service->pmt.opaque = s;
402.     service->pmt.cc = 15;
         ^
403. 
404.     ts->pat.pid = PAT_PID;

libavformat/mpegtsenc.c:404:5: 
402.     service->pmt.cc = 15;
403. 
404.     ts->pat.pid = PAT_PID;
         ^
405.     ts->pat.cc = 15; // Initialize at 15 so that it wraps and be equal to 0 for the first packet we write
406.     ts->pat.write_packet = section_write_packet;

libavformat/mpegtsenc.c:405:5: 
403. 
404.     ts->pat.pid = PAT_PID;
405.     ts->pat.cc = 15; // Initialize at 15 so that it wraps and be equal to 0 for the first packet we write
         ^
406.     ts->pat.write_packet = section_write_packet;
407.     ts->pat.opaque = s;

libavformat/mpegtsenc.c:406:5: 
404.     ts->pat.pid = PAT_PID;
405.     ts->pat.cc = 15; // Initialize at 15 so that it wraps and be equal to 0 for the first packet we write
406.     ts->pat.write_packet = section_write_packet;
         ^
407.     ts->pat.opaque = s;
408. 

libavformat/mpegtsenc.c:407:5: 
405.     ts->pat.cc = 15; // Initialize at 15 so that it wraps and be equal to 0 for the first packet we write
406.     ts->pat.write_packet = section_write_packet;
407.     ts->pat.opaque = s;
         ^
408. 
409.     ts->sdt.pid = SDT_PID;

libavformat/mpegtsenc.c:409:5: 
407.     ts->pat.opaque = s;
408. 
409.     ts->sdt.pid = SDT_PID;
         ^
410.     ts->sdt.cc = 15;
411.     ts->sdt.write_packet = section_write_packet;

libavformat/mpegtsenc.c:410:5: 
408. 
409.     ts->sdt.pid = SDT_PID;
410.     ts->sdt.cc = 15;
         ^
411.     ts->sdt.write_packet = section_write_packet;
412.     ts->sdt.opaque = s;

libavformat/mpegtsenc.c:411:5: 
409.     ts->sdt.pid = SDT_PID;
410.     ts->sdt.cc = 15;
411.     ts->sdt.write_packet = section_write_packet;
         ^
412.     ts->sdt.opaque = s;
413. 

libavformat/mpegtsenc.c:412:5: 
410.     ts->sdt.cc = 15;
411.     ts->sdt.write_packet = section_write_packet;
412.     ts->sdt.opaque = s;
         ^
413. 
414.     /* assign pids to each stream */

libavformat/mpegtsenc.c:415:9: 
413. 
414.     /* assign pids to each stream */
415.     for(i = 0;i < s->nb_streams; i++) {
             ^
416.         st = s->streams[i];
417.         ts_st = av_mallocz(sizeof(MpegTSWriteStream));

libavformat/mpegtsenc.c:415:15: Loop condition is false. Leaving loop
413. 
414.     /* assign pids to each stream */
415.     for(i = 0;i < s->nb_streams; i++) {
                   ^
416.         st = s->streams[i];
417.         ts_st = av_mallocz(sizeof(MpegTSWriteStream));

libavformat/mpegtsenc.c:445:9: Taking false branch
443. 
444.     /* if no video stream, use the first stream as PCR */
445.     if (service->pcr_pid == 0x1fff && s->nb_streams > 0) {
             ^
446.         pcr_st = s->streams[0];
447.         ts_st = pcr_st->priv_data;

libavformat/mpegtsenc.c:451:20: Condition is true
449.     }
450. 
451.     ts->mux_rate = s->mux_rate ? s->mux_rate : 1;
                        ^
452. 
453.     if (ts->mux_rate > 1) {

libavformat/mpegtsenc.c:451:5: 
449.     }
450. 
451.     ts->mux_rate = s->mux_rate ? s->mux_rate : 1;
         ^
452. 
453.     if (ts->mux_rate > 1) {

libavformat/mpegtsenc.c:453:9: Taking false branch
451.     ts->mux_rate = s->mux_rate ? s->mux_rate : 1;
452. 
453.     if (ts->mux_rate > 1) {
             ^
454.         service->pcr_packet_period = (ts->mux_rate * PCR_RETRANS_TIME) /
455.             (TS_PACKET_SIZE * 8 * 1000);

libavformat/mpegtsenc.c:464:9: 
462.     } else {
463.         /* Arbitrary values, PAT/PMT could be written on key frames */
464.         ts->sdt_packet_period = 200;
             ^
465.         ts->pat_packet_period = 40;
466.         if (pcr_st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {

libavformat/mpegtsenc.c:465:9: 
463.         /* Arbitrary values, PAT/PMT could be written on key frames */
464.         ts->sdt_packet_period = 200;
465.         ts->pat_packet_period = 40;
             ^
466.         if (pcr_st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
467.             if (!pcr_st->codec->frame_size) {

libavformat/mpegtsenc.c:466:13: 
464.         ts->sdt_packet_period = 200;
465.         ts->pat_packet_period = 40;
466.         if (pcr_st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
                 ^
467.             if (!pcr_st->codec->frame_size) {
468.                 av_log(s, AV_LOG_WARNING, "frame size not set\n");
