libavformat/utils.c:479: error: Memory Leak
  memory dynamically allocated by call to `av_reallocp()` at line 462, column 24 is not reachable after line 479, column 13.

libavformat/utils.c:453:1: start of procedure probe_codec()
451. /*******************************************************/
452. 
453. static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
     ^
454. {
455.     if(st->codec->codec_id == AV_CODEC_ID_PROBE){

libavformat/utils.c:455:8: Taking true branch
453. static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
454. {
455.     if(st->codec->codec_id == AV_CODEC_ID_PROBE){
            ^
456.         AVProbeData *pd = &st->probe_data;
457.         av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);

libavformat/utils.c:456:9: 
454. {
455.     if(st->codec->codec_id == AV_CODEC_ID_PROBE){
456.         AVProbeData *pd = &st->probe_data;
             ^
457.         av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
458.         --st->probe_packets;

libavformat/utils.c:457:9: Skipping av_log(): empty list of specs
455.     if(st->codec->codec_id == AV_CODEC_ID_PROBE){
456.         AVProbeData *pd = &st->probe_data;
457.         av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
             ^
458.         --st->probe_packets;
459. 

libavformat/utils.c:458:9: 
456.         AVProbeData *pd = &st->probe_data;
457.         av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
458.         --st->probe_packets;
             ^
459. 
460.         if (pkt) {

libavformat/utils.c:460:13: Taking true branch
458.         --st->probe_packets;
459. 
460.         if (pkt) {
                 ^
461.             int err;
462.             if ((err = av_reallocp(&pd->buf, pd->buf_size + pkt->size +

libavformat/utils.c:462:17: 
460.         if (pkt) {
461.             int err;
462.             if ((err = av_reallocp(&pd->buf, pd->buf_size + pkt->size +
                     ^
463.                                    AVPROBE_PADDING_SIZE)) < 0)
464.                 return err;

libavutil/mem.c:139:1: start of procedure av_reallocp()
  137. }
  138. 
  139. int av_reallocp(void *ptr, size_t size)
       ^
  140. {
  141.     void **ptrptr = ptr;

libavutil/mem.c:141:5: 
  139. int av_reallocp(void *ptr, size_t size)
  140. {
  141.     void **ptrptr = ptr;
           ^
  142.     void *ret;
  143. 

libavutil/mem.c:144:10: Taking false branch
  142.     void *ret;
  143. 
  144.     if (!size) {
                ^
  145.         av_freep(ptr);
  146.         return 0;

libavutil/mem.c:148:5: 
  146.         return 0;
  147.     }
  148.     ret = av_realloc(*ptrptr, size);
           ^
  149. 
  150.     if (!ret) {

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 false branch
    121. 
    122.     /* let's disallow possibly ambiguous cases */
    123.     if (size > (INT_MAX - 16))
                 ^
    124.         return NULL;
    125. 

libavutil/mem.c:135:5: 
    133.     return _aligned_realloc(ptr, size, 32);
    134. #else
    135.     return realloc(ptr, size);
             ^
    136. #endif
    137. }

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

libavutil/mem.c:150:10: Taking false branch
  148.     ret = av_realloc(*ptrptr, size);
  149. 
  150.     if (!ret) {
                ^
  151.         av_freep(ptr);
  152.         return AVERROR(ENOMEM);

libavutil/mem.c:155:5: 
  153.     }
  154. 
  155.     *ptrptr = ret;
           ^
  156.     return 0;
  157. }

libavutil/mem.c:156:5: 
  154. 
  155.     *ptrptr = ret;
  156.     return 0;
           ^
  157. }
  158. 

libavutil/mem.c:157:1: return from a call to av_reallocp
  155.     *ptrptr = ret;
  156.     return 0;
  157. }
       ^
  158. 
  159. void *av_realloc_array(void *ptr, size_t nmemb, size_t size)

libavformat/utils.c:462:17: Taking false branch
460.         if (pkt) {
461.             int err;
462.             if ((err = av_reallocp(&pd->buf, pd->buf_size + pkt->size +
                     ^
463.                                    AVPROBE_PADDING_SIZE)) < 0)
464.                 return err;

libavformat/utils.c:465:13: 
463.                                    AVPROBE_PADDING_SIZE)) < 0)
464.                 return err;
465.             memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
                 ^
466.             pd->buf_size += pkt->size;
467.             memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);

libavformat/utils.c:466:13: 
464.                 return err;
465.             memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
466.             pd->buf_size += pkt->size;
                 ^
467.             memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
468.         } else {

libavformat/utils.c:467:13: 
465.             memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
466.             pd->buf_size += pkt->size;
467.             memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
                 ^
468.         } else {
469.             st->probe_packets = 0;

libavformat/utils.c:477:14: Taking false branch
475.         }
476. 
477.         if (!st->probe_packets ||
                  ^
478.             av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
479.             set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);

libavformat/utils.c:478:13: Taking true branch
476. 
477.         if (!st->probe_packets ||
478.             av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
                 ^
479.             set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
480.             if(st->codec->codec_id != AV_CODEC_ID_PROBE){

libavformat/utils.c:479:50: Condition is false
477.         if (!st->probe_packets ||
478.             av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
479.             set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
                                                      ^
480.             if(st->codec->codec_id != AV_CODEC_ID_PROBE){
481.                 pd->buf_size=0;

libavformat/utils.c:479:13: Skipping set_codec_from_probe_data(): empty list of specs
477.         if (!st->probe_packets ||
478.             av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
479.             set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
                 ^
480.             if(st->codec->codec_id != AV_CODEC_ID_PROBE){
481.                 pd->buf_size=0;

static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
{
    if(st->codec->codec_id == AV_CODEC_ID_PROBE){
        AVProbeData *pd = &st->probe_data;
        av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
        --st->probe_packets;
        if (pkt) {
            int err;
            if ((err = av_reallocp(&pd->buf, pd->buf_size + pkt->size +
                                   AVPROBE_PADDING_SIZE)) < 0)
                return err;
            memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
            pd->buf_size += pkt->size;
            memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
        } else {
            st->probe_packets = 0;
            if (!pd->buf_size) {
                av_log(s, AV_LOG_ERROR, "nothing to probe for stream %d\n",
                       st->index);
                return 0;
            }
        }
        if (!st->probe_packets ||
            av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
            set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
            if(st->codec->codec_id != AV_CODEC_ID_PROBE){
                pd->buf_size=0;
                av_freep(&pd->buf);
                av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
            }
        }
    }
    return 0;
}
['static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)\n{\n    if(st->codec->codec_id == AV_CODEC_ID_PROBE){\n        AVProbeData *pd = &st->probe_data;\n        av_log(s, AV_LOG_DEBUG, "probing stream %d\\n", st->index);\n        --st->probe_packets;\n        if (pkt) {\n            int err;\n            if ((err = av_reallocp(&pd->buf, pd->buf_size + pkt->size +\n                                   AVPROBE_PADDING_SIZE)) < 0)\n                return err;\n            memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);\n            pd->buf_size += pkt->size;\n            memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);\n        } else {\n            st->probe_packets = 0;\n            if (!pd->buf_size) {\n                av_log(s, AV_LOG_ERROR, "nothing to probe for stream %d\\n",\n                       st->index);\n                return 0;\n            }\n        }\n        if (!st->probe_packets ||\n            av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {\n            set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);\n            if(st->codec->codec_id != AV_CODEC_ID_PROBE){\n                pd->buf_size=0;\n                av_freep(&pd->buf);\n                av_log(s, AV_LOG_DEBUG, "probed stream %d\\n", st->index);\n            }\n        }\n    }\n    return 0;\n}', 'int av_reallocp(void *ptr, size_t size)\n{\n    void **ptrptr = ptr;\n    void *ret;\n    if (!size) {\n        av_freep(ptr);\n        return 0;\n    }\n    ret = av_realloc(*ptrptr, size);\n    if (!ret) {\n        av_freep(ptr);\n        return AVERROR(ENOMEM);\n    }\n    *ptrptr = ret;\n    return 0;\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}']