libavcodec/avpacket.c:336: error: Null Dereference
  pointer `dst->side_data` last assigned on line 333 could be null and is dereferenced by call to `av_packet_free_side_data()` at line 336, column 13.

libavcodec/avpacket.c:316:1: start of procedure av_packet_copy_props()
314. }
315. 
316. int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
     ^
317. {
318.     int i;

libavcodec/avpacket.c:320:5: 
318.     int i;
319. 
320.     dst->pts                  = src->pts;
         ^
321.     dst->dts                  = src->dts;
322.     dst->pos                  = src->pos;

libavcodec/avpacket.c:321:5: 
319. 
320.     dst->pts                  = src->pts;
321.     dst->dts                  = src->dts;
         ^
322.     dst->pos                  = src->pos;
323.     dst->duration             = src->duration;

libavcodec/avpacket.c:322:5: 
320.     dst->pts                  = src->pts;
321.     dst->dts                  = src->dts;
322.     dst->pos                  = src->pos;
         ^
323.     dst->duration             = src->duration;
324.     dst->convergence_duration = src->convergence_duration;

libavcodec/avpacket.c:323:5: 
321.     dst->dts                  = src->dts;
322.     dst->pos                  = src->pos;
323.     dst->duration             = src->duration;
         ^
324.     dst->convergence_duration = src->convergence_duration;
325.     dst->flags                = src->flags;

libavcodec/avpacket.c:324:5: 
322.     dst->pos                  = src->pos;
323.     dst->duration             = src->duration;
324.     dst->convergence_duration = src->convergence_duration;
         ^
325.     dst->flags                = src->flags;
326.     dst->stream_index         = src->stream_index;

libavcodec/avpacket.c:325:5: 
323.     dst->duration             = src->duration;
324.     dst->convergence_duration = src->convergence_duration;
325.     dst->flags                = src->flags;
         ^
326.     dst->stream_index         = src->stream_index;
327.     dst->side_data_elems      = src->side_data_elems;

libavcodec/avpacket.c:326:5: 
324.     dst->convergence_duration = src->convergence_duration;
325.     dst->flags                = src->flags;
326.     dst->stream_index         = src->stream_index;
         ^
327.     dst->side_data_elems      = src->side_data_elems;
328. 

libavcodec/avpacket.c:327:5: 
325.     dst->flags                = src->flags;
326.     dst->stream_index         = src->stream_index;
327.     dst->side_data_elems      = src->side_data_elems;
         ^
328. 
329.     for (i = 0; i < src->side_data_elems; i++) {

libavcodec/avpacket.c:329:10: 
327.     dst->side_data_elems      = src->side_data_elems;
328. 
329.     for (i = 0; i < src->side_data_elems; i++) {
              ^
330.          enum AVPacketSideDataType type = src->side_data[i].type;
331.          int size          = src->side_data[i].size;

libavcodec/avpacket.c:329:17: Loop condition is true. Entering loop body
327.     dst->side_data_elems      = src->side_data_elems;
328. 
329.     for (i = 0; i < src->side_data_elems; i++) {
                     ^
330.          enum AVPacketSideDataType type = src->side_data[i].type;
331.          int size          = src->side_data[i].size;

libavcodec/avpacket.c:330:10: 
328. 
329.     for (i = 0; i < src->side_data_elems; i++) {
330.          enum AVPacketSideDataType type = src->side_data[i].type;
              ^
331.          int size          = src->side_data[i].size;
332.          uint8_t *src_data = src->side_data[i].data;

libavcodec/avpacket.c:331:10: 
329.     for (i = 0; i < src->side_data_elems; i++) {
330.          enum AVPacketSideDataType type = src->side_data[i].type;
331.          int size          = src->side_data[i].size;
              ^
332.          uint8_t *src_data = src->side_data[i].data;
333.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);

libavcodec/avpacket.c:332:10: 
330.          enum AVPacketSideDataType type = src->side_data[i].type;
331.          int size          = src->side_data[i].size;
332.          uint8_t *src_data = src->side_data[i].data;
              ^
333.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
334. 

libavcodec/avpacket.c:333:10: 
331.          int size          = src->side_data[i].size;
332.          uint8_t *src_data = src->side_data[i].data;
333.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
              ^
334. 
335.         if (!dst_data) {

libavcodec/avpacket.c:260:1: start of procedure av_packet_new_side_data()
  258. }
  259. 
  260. uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
       ^
  261.                                  int size)
  262. {

libavcodec/avpacket.c:263:5: 
  261.                                  int size)
  262. {
  263.     int elems = pkt->side_data_elems;
           ^
  264. 
  265.     if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))

libavcodec/avpacket.c:265:9: Taking false branch
  263.     int elems = pkt->side_data_elems;
  264. 
  265.     if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
               ^
  266.         return NULL;
  267.     if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)

libavcodec/avpacket.c:267:9: Taking false branch
  265.     if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
  266.         return NULL;
  267.     if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
               ^
  268.         return NULL;
  269. 

libavcodec/avpacket.c:270:5: 
  268.         return NULL;
  269. 
  270.     pkt->side_data = av_realloc(pkt->side_data,
           ^
  271.                                 (elems + 1) * sizeof(*pkt->side_data));
  272.     if (!pkt->side_data)

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_realloc_array(void *ptr, size_t nmemb, size_t size)

libavcodec/avpacket.c:272:10: Taking true branch
  270.     pkt->side_data = av_realloc(pkt->side_data,
  271.                                 (elems + 1) * sizeof(*pkt->side_data));
  272.     if (!pkt->side_data)
                ^
  273.         return NULL;
  274. 

libavcodec/avpacket.c:273:9: 
  271.                                 (elems + 1) * sizeof(*pkt->side_data));
  272.     if (!pkt->side_data)
  273.         return NULL;
               ^
  274. 
  275.     pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/avpacket.c:283:1: return from a call to av_packet_new_side_data
  281. 
  282.     return pkt->side_data[elems].data;
  283. }
       ^
  284. 
  285. uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,

libavcodec/avpacket.c:335:14: Taking true branch
333.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
334. 
335.         if (!dst_data) {
                  ^
336.             av_packet_free_side_data(dst);
337.             return AVERROR(ENOMEM);

libavcodec/avpacket.c:336:13: 
334. 
335.         if (!dst_data) {
336.             av_packet_free_side_data(dst);
                 ^
337.             return AVERROR(ENOMEM);
338.         }

libavcodec/avpacket.c:232:1: start of procedure av_packet_free_side_data()
  230. }
  231. 
  232. void av_packet_free_side_data(AVPacket *pkt)
       ^
  233. {
  234.     int i;

libavcodec/avpacket.c:235:10: 
  233. {
  234.     int i;
  235.     for (i = 0; i < pkt->side_data_elems; i++)
                ^
  236.         av_free(pkt->side_data[i].data);
  237.     av_freep(&pkt->side_data);

libavcodec/avpacket.c:235:17: Loop condition is true. Entering loop body
  233. {
  234.     int i;
  235.     for (i = 0; i < pkt->side_data_elems; i++)
                       ^
  236.         av_free(pkt->side_data[i].data);
  237.     av_freep(&pkt->side_data);

libavcodec/avpacket.c:236:9: 
  234.     int i;
  235.     for (i = 0; i < pkt->side_data_elems; i++)
  236.         av_free(pkt->side_data[i].data);
               ^
  237.     av_freep(&pkt->side_data);
  238.     pkt->side_data_elems = 0;

int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
{
    int i;
    dst->pts                  = src->pts;
    dst->dts                  = src->dts;
    dst->pos                  = src->pos;
    dst->duration             = src->duration;
    dst->convergence_duration = src->convergence_duration;
    dst->flags                = src->flags;
    dst->stream_index         = src->stream_index;
    dst->side_data_elems      = src->side_data_elems;
    for (i = 0; i < src->side_data_elems; i++) {
         enum AVPacketSideDataType type = src->side_data[i].type;
         int size          = src->side_data[i].size;
         uint8_t *src_data = src->side_data[i].data;
         uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
        if (!dst_data) {
            av_packet_free_side_data(dst);
            return AVERROR(ENOMEM);
        }
        memcpy(dst_data, src_data, size);
    }
    return 0;
}
['int av_packet_copy_props(AVPacket *dst, const AVPacket *src)\n{\n    int i;\n    dst->pts                  = src->pts;\n    dst->dts                  = src->dts;\n    dst->pos                  = src->pos;\n    dst->duration             = src->duration;\n    dst->convergence_duration = src->convergence_duration;\n    dst->flags                = src->flags;\n    dst->stream_index         = src->stream_index;\n    dst->side_data_elems      = src->side_data_elems;\n    for (i = 0; i < src->side_data_elems; i++) {\n         enum AVPacketSideDataType type = src->side_data[i].type;\n         int size          = src->side_data[i].size;\n         uint8_t *src_data = src->side_data[i].data;\n         uint8_t *dst_data = av_packet_new_side_data(dst, type, size);\n        if (!dst_data) {\n            av_packet_free_side_data(dst);\n            return AVERROR(ENOMEM);\n        }\n        memcpy(dst_data, src_data, size);\n    }\n    return 0;\n}', 'uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,\n                                 int size)\n{\n    int elems = pkt->side_data_elems;\n    if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))\n        return NULL;\n    if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)\n        return NULL;\n    pkt->side_data = av_realloc(pkt->side_data,\n                                (elems + 1) * sizeof(*pkt->side_data));\n    if (!pkt->side_data)\n        return NULL;\n    pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);\n    if (!pkt->side_data[elems].data)\n        return NULL;\n    pkt->side_data[elems].size = size;\n    pkt->side_data[elems].type = type;\n    pkt->side_data_elems++;\n    return pkt->side_data[elems].data;\n}', 'void *av_realloc(void *ptr, size_t size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if (size > (INT_MAX - 16))\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if (!ptr)\n        return av_malloc(size);\n    diff = ((char *)ptr)[-1];\n    return (char *)realloc((char *)ptr - diff, size + diff) + diff;\n#elif HAVE_ALIGNED_MALLOC\n    return _aligned_realloc(ptr, size, 32);\n#else\n    return realloc(ptr, size);\n#endif\n}', 'void av_packet_free_side_data(AVPacket *pkt)\n{\n    int i;\n    for (i = 0; i < pkt->side_data_elems; i++)\n        av_free(pkt->side_data[i].data);\n    av_freep(&pkt->side_data);\n    pkt->side_data_elems = 0;\n}']