libavformat/mxfenc.c:1214: error: Null Dereference
  pointer `mxf->body_partition_offset` last assigned on line 1210 could be null and is dereferenced at line 1214, column 9.

libavformat/mxfenc.c:1187:1: start of procedure mxf_write_partition()
1185. }
1186. 
1187. static void mxf_write_partition(AVFormatContext *s, int bodysid,
      ^
1188.                                 int indexsid,
1189.                                 const uint8_t *key, int write_metadata)

libavformat/mxfenc.c:1191:5: 
1189.                                 const uint8_t *key, int write_metadata)
1190. {
1191.     MXFContext *mxf = s->priv_data;
          ^
1192.     AVIOContext *pb = s->pb;
1193.     int64_t header_byte_count_offset;

libavformat/mxfenc.c:1192:5: 
1190. {
1191.     MXFContext *mxf = s->priv_data;
1192.     AVIOContext *pb = s->pb;
          ^
1193.     int64_t header_byte_count_offset;
1194.     unsigned index_byte_count = 0;

libavformat/mxfenc.c:1194:5: 
1192.     AVIOContext *pb = s->pb;
1193.     int64_t header_byte_count_offset;
1194.     unsigned index_byte_count = 0;
          ^
1195.     uint64_t partition_offset = avio_tell(pb);
1196. 

libavformat/mxfenc.c:1195:5: 
1193.     int64_t header_byte_count_offset;
1194.     unsigned index_byte_count = 0;
1195.     uint64_t partition_offset = avio_tell(pb);
          ^
1196. 
1197.     if (!mxf->edit_unit_byte_count && mxf->edit_units_count)

libavformat/avio.h:219:1: start of procedure avio_tell()
  217.  * @return position or AVERROR.
  218.  */
  219. static av_always_inline int64_t avio_tell(AVIOContext *s)
       ^
  220. {
  221.     return avio_seek(s, 0, SEEK_CUR);

libavformat/avio.h:221:5: Skipping avio_seek(): empty list of specs
  219. static av_always_inline int64_t avio_tell(AVIOContext *s)
  220. {
  221.     return avio_seek(s, 0, SEEK_CUR);
           ^
  222. }
  223. 

libavformat/avio.h:222:1: return from a call to avio_tell
  220. {
  221.     return avio_seek(s, 0, SEEK_CUR);
  222. }
       ^
  223. 
  224. /**

libavformat/mxfenc.c:1197:10: Taking true branch
1195.     uint64_t partition_offset = avio_tell(pb);
1196. 
1197.     if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
               ^
1198.         index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
1199.             12+mxf->edit_units_count*(11+mxf->slice_count*4);

libavformat/mxfenc.c:1197:39: Taking true branch
1195.     uint64_t partition_offset = avio_tell(pb);
1196. 
1197.     if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
                                            ^
1198.         index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
1199.             12+mxf->edit_units_count*(11+mxf->slice_count*4);

libavformat/mxfenc.c:1198:9: 
1196. 
1197.     if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
1198.         index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
              ^
1199.             12+mxf->edit_units_count*(11+mxf->slice_count*4);
1200.     else if (mxf->edit_unit_byte_count && indexsid)

libavformat/mxfenc.c:1203:9: Taking true branch
1201.         index_byte_count = 80;
1202. 
1203.     if (index_byte_count) {
              ^
1204.         // add encoded ber length
1205.         index_byte_count += 16 + klv_ber_length(index_byte_count);

libavformat/mxfenc.c:1205:9: 
1203.     if (index_byte_count) {
1204.         // add encoded ber length
1205.         index_byte_count += 16 + klv_ber_length(index_byte_count);
              ^
1206.         index_byte_count += klv_fill_size(index_byte_count);
1207.     }

libavformat/mxfenc.c:332:1: start of procedure klv_ber_length()
  330. }
  331. 
  332. static int klv_ber_length(uint64_t len)
       ^
  333. {
  334.     if (len < 128)

libavformat/mxfenc.c:334:9: Taking true branch
  332. static int klv_ber_length(uint64_t len)
  333. {
  334.     if (len < 128)
               ^
  335.         return 1;
  336.     else

libavformat/mxfenc.c:335:9: 
  333. {
  334.     if (len < 128)
  335.         return 1;
               ^
  336.     else
  337.         return (av_log2(len) >> 3) + 2;

libavformat/mxfenc.c:338:1: return from a call to klv_ber_length
  336.     else
  337.         return (av_log2(len) >> 3) + 2;
  338. }
       ^
  339. 
  340. static int klv_encode_ber_length(AVIOContext *pb, uint64_t len)

libavformat/mxfenc.c:1206:9: 
1204.         // add encoded ber length
1205.         index_byte_count += 16 + klv_ber_length(index_byte_count);
1206.         index_byte_count += klv_fill_size(index_byte_count);
              ^
1207.     }
1208. 

libavformat/mxfenc.c:1032:1: start of procedure klv_fill_size()
  1030. }
  1031. 
  1032. static unsigned klv_fill_size(uint64_t size)
        ^
  1033. {
  1034.     unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1));

libavformat/mxfenc.c:1034:5: 
  1032. static unsigned klv_fill_size(uint64_t size)
  1033. {
  1034.     unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1));
            ^
  1035.     if (pad < 20) // smallest fill item possible
  1036.         return pad + KAG_SIZE;

libavformat/mxfenc.c:1035:9: Taking true branch
  1033. {
  1034.     unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1));
  1035.     if (pad < 20) // smallest fill item possible
                ^
  1036.         return pad + KAG_SIZE;
  1037.     else

libavformat/mxfenc.c:1036:9: 
  1034.     unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1));
  1035.     if (pad < 20) // smallest fill item possible
  1036.         return pad + KAG_SIZE;
                ^
  1037.     else
  1038.         return pad & (KAG_SIZE-1);

libavformat/mxfenc.c:1039:1: return from a call to klv_fill_size
  1037.     else
  1038.         return pad & (KAG_SIZE-1);
  1039. }
        ^
  1040. 
  1041. static void mxf_write_index_table_segment(AVFormatContext *s)

libavformat/mxfenc.c:1209:10: Taking true branch
1207.     }
1208. 
1209.     if (!memcmp(key, body_partition_key, 16)) {
               ^
1210.         mxf->body_partition_offset =
1211.             av_realloc(mxf->body_partition_offset,

libavformat/mxfenc.c:1210:9: 
1208. 
1209.     if (!memcmp(key, body_partition_key, 16)) {
1210.         mxf->body_partition_offset =
              ^
1211.             av_realloc(mxf->body_partition_offset,
1212.                        (mxf->body_partitions_count+1)*

libavutil/mem.c:116:1: start of procedure av_realloc()
  114. }
  115. 
  116. void *av_realloc(void *ptr, size_t size)
       ^
  117. {
  118. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:123:9: Taking true branch
  121. 
  122.     /* let's disallow possible ambiguous cases */
  123.     if (size > (INT_MAX - 16))
               ^
  124.         return NULL;
  125. 

libavutil/mem.c:124:9: 
  122.     /* let's disallow possible ambiguous cases */
  123.     if (size > (INT_MAX - 16))
  124.         return NULL;
               ^
  125. 
  126. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:137:1: return from a call to av_realloc
  135.     return realloc(ptr, size);
  136. #endif
  137. }
       ^
  138. 
  139. void av_free(void *ptr)

libavformat/mxfenc.c:1214:9: 
1212.                        (mxf->body_partitions_count+1)*
1213.                        sizeof(*mxf->body_partition_offset));
1214.         mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset;
              ^
1215.     }
1216. 
