libavformat/movenc.c:2770: error: Null Dereference
  pointer `pkt.data` last assigned on line 2769 could be null and is dereferenced at line 2770, column 13.

libavformat/movenc.c:2745:1: start of procedure mov_create_chapter_track()
2743. // QuickTime chapters involve an additional text track with the chapter names
2744. // as samples, and a tref pointing from the other tracks to the chapter one.
2745. static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
      ^
2746. {
2747.     MOVMuxContext *mov = s->priv_data;

libavformat/movenc.c:2747:5: 
2745. static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
2746. {
2747.     MOVMuxContext *mov = s->priv_data;
          ^
2748.     MOVTrack *track = &mov->tracks[tracknum];
2749.     AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };

libavformat/movenc.c:2748:5: 
2746. {
2747.     MOVMuxContext *mov = s->priv_data;
2748.     MOVTrack *track = &mov->tracks[tracknum];
          ^
2749.     AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
2750.     int i, len;

libavformat/movenc.c:2749:5: 
2747.     MOVMuxContext *mov = s->priv_data;
2748.     MOVTrack *track = &mov->tracks[tracknum];
2749.     AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
          ^
2750.     int i, len;
2751. 

libavformat/movenc.c:2752:5: 
2750.     int i, len;
2751. 
2752.     track->mode = mov->mode;
          ^
2753.     track->tag = MKTAG('t','e','x','t');
2754.     track->timescale = MOV_TIMESCALE;

libavformat/movenc.c:2753:5: 
2751. 
2752.     track->mode = mov->mode;
2753.     track->tag = MKTAG('t','e','x','t');
          ^
2754.     track->timescale = MOV_TIMESCALE;
2755.     track->enc = avcodec_alloc_context3(NULL);

libavformat/movenc.c:2754:5: 
2752.     track->mode = mov->mode;
2753.     track->tag = MKTAG('t','e','x','t');
2754.     track->timescale = MOV_TIMESCALE;
          ^
2755.     track->enc = avcodec_alloc_context3(NULL);
2756.     track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;

libavformat/movenc.c:2755:5: 
2753.     track->tag = MKTAG('t','e','x','t');
2754.     track->timescale = MOV_TIMESCALE;
2755.     track->enc = avcodec_alloc_context3(NULL);
          ^
2756.     track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
2757. 

libavcodec/options.c:473:1: start of procedure avcodec_alloc_context3()
  471. }
  472. 
  473. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
       ^
  474.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
  475. 

libavcodec/options.c:474:5: 
  472. 
  473. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
  474.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
           ^
  475. 
  476.     if(avctx==NULL) return NULL;

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.    linker will do it automatically. */
    63. 
    64. void *av_malloc(size_t size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(size_t size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:8: Taking false branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-32) )
               ^
    73.         return NULL;
    74. 

libavutil/mem.c:83:9: Taking false branch
    81.     ((char*)ptr)[-1]= diff;
    82. #elif HAVE_POSIX_MEMALIGN
    83.     if (posix_memalign(&ptr,32,size))
                ^
    84.         ptr = NULL;
    85. #elif HAVE_MEMALIGN

libavutil/mem.c:114:5: 
    112.     ptr = malloc(size);
    113. #endif
    114.     return ptr;
             ^
    115. }
    116. 

libavutil/mem.c:115:1: return from a call to av_malloc
    113. #endif
    114.     return ptr;
    115. }
         ^
    116. 
    117. void *av_realloc(void *ptr, size_t size)

libavcodec/options.c:476:8: Taking false branch
  474.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
  475. 
  476.     if(avctx==NULL) return NULL;
              ^
  477. 
  478.     if(avcodec_get_context_defaults3(avctx, codec) < 0){

libavcodec/options.c:478:8: Taking false branch
  476.     if(avctx==NULL) return NULL;
  477. 
  478.     if(avcodec_get_context_defaults3(avctx, codec) < 0){
              ^
  479.         av_free(avctx);
  480.         return NULL;

libavcodec/options.c:483:5: 
  481.     }
  482. 
  483.     return avctx;
           ^
  484. }
  485. 

libavcodec/options.c:484:1: return from a call to avcodec_alloc_context3
  482. 
  483.     return avctx;
  484. }
       ^
  485. 
  486. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)

libavformat/movenc.c:2756:5: 
2754.     track->timescale = MOV_TIMESCALE;
2755.     track->enc = avcodec_alloc_context3(NULL);
2756.     track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
          ^
2757. 
2758.     for (i = 0; i < s->nb_chapters; i++) {

libavformat/movenc.c:2758:10: 
2756.     track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
2757. 
2758.     for (i = 0; i < s->nb_chapters; i++) {
               ^
2759.         AVChapter *c = s->chapters[i];
2760.         AVDictionaryEntry *t;

libavformat/movenc.c:2758:17: Loop condition is true. Entering loop body
2756.     track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
2757. 
2758.     for (i = 0; i < s->nb_chapters; i++) {
                      ^
2759.         AVChapter *c = s->chapters[i];
2760.         AVDictionaryEntry *t;

libavformat/movenc.c:2759:9: 
2757. 
2758.     for (i = 0; i < s->nb_chapters; i++) {
2759.         AVChapter *c = s->chapters[i];
              ^
2760.         AVDictionaryEntry *t;
2761. 

libavformat/movenc.c:2762:9: 
2760.         AVDictionaryEntry *t;
2761. 
2762.         int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
              ^
2763.         pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
2764.         pkt.duration = end - pkt.dts;

libavutil/mathematics.c:133:1: start of procedure av_rescale_q()
  131. }
  132. 
  133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
       ^
  134.     int64_t b= bq.num * (int64_t)cq.den;
  135.     int64_t c= cq.num * (int64_t)bq.den;

libavutil/mathematics.c:134:5: 
  132. 
  133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
  134.     int64_t b= bq.num * (int64_t)cq.den;
           ^
  135.     int64_t c= cq.num * (int64_t)bq.den;
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);

libavutil/mathematics.c:135:5: 
  133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
  134.     int64_t b= bq.num * (int64_t)cq.den;
  135.     int64_t c= cq.num * (int64_t)bq.den;
           ^
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
  137. }

libavutil/mathematics.c:136:5: Skipping av_rescale_rnd(): empty list of specs
  134.     int64_t b= bq.num * (int64_t)cq.den;
  135.     int64_t c= cq.num * (int64_t)bq.den;
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
           ^
  137. }
  138. 

libavutil/mathematics.c:137:1: return from a call to av_rescale_q
  135.     int64_t c= cq.num * (int64_t)bq.den;
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
  137. }
       ^
  138. 
  139. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){

libavformat/movenc.c:2763:9: 
2761. 
2762.         int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
2763.         pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
              ^
2764.         pkt.duration = end - pkt.dts;
2765. 

libavutil/mathematics.c:133:1: start of procedure av_rescale_q()
  131. }
  132. 
  133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
       ^
  134.     int64_t b= bq.num * (int64_t)cq.den;
  135.     int64_t c= cq.num * (int64_t)bq.den;

libavutil/mathematics.c:134:5: 
  132. 
  133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
  134.     int64_t b= bq.num * (int64_t)cq.den;
           ^
  135.     int64_t c= cq.num * (int64_t)bq.den;
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);

libavutil/mathematics.c:135:5: 
  133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
  134.     int64_t b= bq.num * (int64_t)cq.den;
  135.     int64_t c= cq.num * (int64_t)bq.den;
           ^
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
  137. }

libavutil/mathematics.c:136:5: Skipping av_rescale_rnd(): empty list of specs
  134.     int64_t b= bq.num * (int64_t)cq.den;
  135.     int64_t c= cq.num * (int64_t)bq.den;
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
           ^
  137. }
  138. 

libavutil/mathematics.c:137:1: return from a call to av_rescale_q
  135.     int64_t c= cq.num * (int64_t)bq.den;
  136.     return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
  137. }
       ^
  138. 
  139. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){

libavformat/movenc.c:2764:9: 
2762.         int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
2763.         pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
2764.         pkt.duration = end - pkt.dts;
              ^
2765. 
2766.         if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {

libavformat/movenc.c:2766:14: Taking true branch
2764.         pkt.duration = end - pkt.dts;
2765. 
2766.         if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
                   ^
2767.             len = strlen(t->value);
2768.             pkt.size = len+2;

libavformat/movenc.c:2767:13: 
2765. 
2766.         if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
2767.             len = strlen(t->value);
                  ^
2768.             pkt.size = len+2;
2769.             pkt.data = av_malloc(pkt.size);

libavformat/movenc.c:2768:13: 
2766.         if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
2767.             len = strlen(t->value);
2768.             pkt.size = len+2;
                  ^
2769.             pkt.data = av_malloc(pkt.size);
2770.             AV_WB16(pkt.data, len);

libavformat/movenc.c:2769:13: 
2767.             len = strlen(t->value);
2768.             pkt.size = len+2;
2769.             pkt.data = av_malloc(pkt.size);
                  ^
2770.             AV_WB16(pkt.data, len);
2771.             memcpy(pkt.data+2, t->value, len);

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(size_t size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(size_t size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking true branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-32) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:73:9: 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-32) )
  73.         return NULL;
              ^
  74. 
  75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:115:1: return from a call to av_malloc
  113. #endif
  114.     return ptr;
  115. }
       ^
  116. 
  117. void *av_realloc(void *ptr, size_t size)

libavformat/movenc.c:2770:13: 
2768.             pkt.size = len+2;
2769.             pkt.data = av_malloc(pkt.size);
2770.             AV_WB16(pkt.data, len);
                  ^
2771.             memcpy(pkt.data+2, t->value, len);
2772.             ff_mov_write_packet(s, &pkt);

libavutil/bswap.h:58:1: start of procedure av_bswap16()
  56. 
  57. #ifndef av_bswap16
  58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
      ^
  59. {
  60.     x= (x>>8) | (x<<8);

libavutil/bswap.h:60:5: 
  58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
  59. {
  60.     x= (x>>8) | (x<<8);
          ^
  61.     return x;
  62. }

libavutil/bswap.h:61:5: 
  59. {
  60.     x= (x>>8) | (x<<8);
  61.     return x;
          ^
  62. }
  63. #endif

libavutil/bswap.h:62:1: return from a call to av_bswap16
  60.     x= (x>>8) | (x<<8);
  61.     return x;
  62. }
      ^
  63. #endif
  64. 
