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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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