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

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

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

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

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

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

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

libavformat/utils.c:461:17: 
459.         if (pkt) {
460.             int err;
461.             if ((err = av_reallocp(&pd->buf, pd->buf_size + pkt->size +
                     ^
462.                                    AVPROBE_PADDING_SIZE)) < 0)
463.                 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:5: 
  142.     void *ret;
  143. 
  144.     ret = av_realloc(*ptrptr, size);
           ^
  145. 
  146.     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:146:10: Taking false branch
  144.     ret = av_realloc(*ptrptr, size);
  145. 
  146.     if (!ret) {
                ^
  147.         av_freep(ptr);
  148.         return AVERROR(ENOMEM);

libavutil/mem.c:151:5: 
  149.     }
  150. 
  151.     *ptrptr = ret;
           ^
  152.     return 0;
  153. }

libavutil/mem.c:152:5: 
  150. 
  151.     *ptrptr = ret;
  152.     return 0;
           ^
  153. }
  154. 

libavutil/mem.c:153:1: return from a call to av_reallocp
  151.     *ptrptr = ret;
  152.     return 0;
  153. }
       ^
  154. 
  155. void *av_realloc_array(void *ptr, size_t nmemb, size_t size)

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

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

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

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

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

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

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

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