libavutil/mem.c:159: error: Memory Leak
  memory dynamically allocated by call to `av_realloc()` at line 150, column 11 is not reachable after line 159, column 1.

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

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

libavutil/mem.c:149:5: 
147.     }
148. 
149.     memcpy(&val, ptr, sizeof(val));
         ^
150.     val = av_realloc(val, size);
151. 

libavutil/mem.c:150:5: 
148. 
149.     memcpy(&val, ptr, sizeof(val));
150.     val = av_realloc(val, size);
         ^
151. 
152.     if (!val) {

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

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

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

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

libavutil/mem.c:152:10: Taking false branch
150.     val = av_realloc(val, size);
151. 
152.     if (!val) {
              ^
153.         av_freep(ptr);
154.         return AVERROR(ENOMEM);

libavutil/mem.c:157:5: 
155.     }
156. 
157.     memcpy(ptr, &val, sizeof(val));
         ^
158.     return 0;
159. }

libavutil/mem.c:158:5: 
156. 
157.     memcpy(ptr, &val, sizeof(val));
158.     return 0;
         ^
159. }
160. 

libavutil/mem.c:159:1: return from a call to av_reallocp
157.     memcpy(ptr, &val, sizeof(val));
158.     return 0;
159. }
     ^
160. 
161. void *av_realloc_array(void *ptr, size_t nmemb, size_t size)

int av_reallocp(void *ptr, size_t size)
{
    void *val;
    if (!size) {
        av_freep(ptr);
        return 0;
    }
    memcpy(&val, ptr, sizeof(val));
    val = av_realloc(val, size);
    if (!val) {
        av_freep(ptr);
        return AVERROR(ENOMEM);
    }
    memcpy(ptr, &val, sizeof(val));
    return 0;
}
['int av_reallocp(void *ptr, size_t size)\n{\n    void *val;\n    if (!size) {\n        av_freep(ptr);\n        return 0;\n    }\n    memcpy(&val, ptr, sizeof(val));\n    val = av_realloc(val, size);\n    if (!val) {\n        av_freep(ptr);\n        return AVERROR(ENOMEM);\n    }\n    memcpy(ptr, &val, sizeof(val));\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}']