libavcodec/utils.c:272: error: Use After Free
  accessing memory that was invalidated by call to `free()` on line 271 indirectly during the call to `av_free()`.

libavcodec/utils.c:258:24: invalidation part of the trace starts here
256.     /* allocate InternalBuffer if needed */
257.     if (!avci->buffer) {
258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
                            ^
259.         if (!avci->buffer)
260.             return AVERROR(ENOMEM);

libavcodec/utils.c:258:24: passed as argument to `av_mallocz`
  256.     /* allocate InternalBuffer if needed */
  257.     if (!avci->buffer) {
  258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
                              ^
  259.         if (!avci->buffer)
  260.             return AVERROR(ENOMEM);

libavcodec/utils.c:258:24: return from call to `av_mallocz`
  256.     /* allocate InternalBuffer if needed */
  257.     if (!avci->buffer) {
  258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
                              ^
  259.         if (!avci->buffer)
  260.             return AVERROR(ENOMEM);

libavcodec/utils.c:258:9: assigned
  256.     /* allocate InternalBuffer if needed */
  257.     if (!avci->buffer) {
  258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
               ^
  259.         if (!avci->buffer)
  260.             return AVERROR(ENOMEM);

libavcodec/utils.c:262:5: assigned
  260.             return AVERROR(ENOMEM);
  261.     }
  262.     buf = avci->buffer;
           ^
  263. 
  264.     /* if there is a previously-used internal buffer, check its size and

libavcodec/utils.c:271:17: when calling `av_free` here
  269.             av_free(buf->extended_data[0]);
  270.             if (buf->extended_data != buf->data)
  271.                 av_free(&buf->extended_data);
                       ^
  272.             buf->extended_data = NULL;
  273.             buf->data[0] = NULL;

libavutil/mem.c:137:1: parameter `ptr` of av_free
    135. }
    136. 
    137. void av_free(void *ptr)
         ^
    138. {
    139. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:143:5: was invalidated by call to `free()`
    141.         free((char*)ptr - ((char*)ptr)[-1]);
    142. #else
    143.     free(ptr);
             ^
    144. #endif
    145. }

libavcodec/utils.c:258:24: use-after-lifetime part of the trace starts here
256.     /* allocate InternalBuffer if needed */
257.     if (!avci->buffer) {
258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
                            ^
259.         if (!avci->buffer)
260.             return AVERROR(ENOMEM);

libavcodec/utils.c:258:24: passed as argument to `av_mallocz`
  256.     /* allocate InternalBuffer if needed */
  257.     if (!avci->buffer) {
  258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
                              ^
  259.         if (!avci->buffer)
  260.             return AVERROR(ENOMEM);

libavcodec/utils.c:258:24: return from call to `av_mallocz`
  256.     /* allocate InternalBuffer if needed */
  257.     if (!avci->buffer) {
  258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
                              ^
  259.         if (!avci->buffer)
  260.             return AVERROR(ENOMEM);

libavcodec/utils.c:258:9: assigned
  256.     /* allocate InternalBuffer if needed */
  257.     if (!avci->buffer) {
  258.         avci->buffer = av_mallocz(sizeof(InternalBuffer));
               ^
  259.         if (!avci->buffer)
  260.             return AVERROR(ENOMEM);

libavcodec/utils.c:262:5: assigned
  260.             return AVERROR(ENOMEM);
  261.     }
  262.     buf = avci->buffer;
           ^
  263. 
  264.     /* if there is a previously-used internal buffer, check its size and

libavcodec/utils.c:272:13: invalid access occurs here
  270.             if (buf->extended_data != buf->data)
  271.                 av_free(&buf->extended_data);
  272.             buf->extended_data = NULL;
                   ^
  273.             buf->data[0] = NULL;
  274.         }
