libavformat/swfenc.c:486: error: Use After Free
  call to `av_fifo_free()` eventually accesses memory that was invalidated by call to `free()` on line 486 indirectly during the call to `av_fifo_free()`.

libavformat/swfenc.c:473:1: invalidation part of the trace starts here
471. }
472. 
473. static int swf_write_trailer(AVFormatContext *s)
     ^
474. {
475.     SWFContext *swf = s->priv_data;

libavformat/swfenc.c:473:1: parameter `s` of swf_write_trailer
  471. }
  472. 
  473. static int swf_write_trailer(AVFormatContext *s)
       ^
  474. {
  475.     SWFContext *swf = s->priv_data;

libavformat/swfenc.c:475:5: assigned
  473. static int swf_write_trailer(AVFormatContext *s)
  474. {
  475.     SWFContext *swf = s->priv_data;
           ^
  476.     ByteIOContext *pb = s->pb;
  477.     AVCodecContext *enc, *video_enc;

libavformat/swfenc.c:486:13: when calling `av_fifo_free` here
  484.             video_enc = enc;
  485.         else
  486.             av_fifo_free(swf->audio_fifo);
                   ^
  487.     }
  488. 

libavutil/fifo.c:38:1: parameter `f` of av_fifo_free
    36. }
    37. 
    38. void av_fifo_free(AVFifoBuffer *f)
        ^
    39. {
    40.     if(f){

libavutil/fifo.c:42:9: when calling `av_free` here
    40.     if(f){
    41.         av_free(f->buffer);
    42.         av_free(f);
                ^
    43.     }
    44. }

libavutil/mem.c:122:1: parameter `ptr` of av_free
      120. }
      121. 
      122. void av_free(void *ptr)
           ^
      123. {
      124.     /* XXX: this test should not be needed on most libcs */

libavutil/mem.c:129:9: was invalidated by call to `free()`
      127.         free((char*)ptr - ((char*)ptr)[-1]);
      128. #else
      129.         free(ptr);
                   ^
      130. #endif
      131. }

libavformat/swfenc.c:473:1: use-after-lifetime part of the trace starts here
471. }
472. 
473. static int swf_write_trailer(AVFormatContext *s)
     ^
474. {
475.     SWFContext *swf = s->priv_data;

libavformat/swfenc.c:473:1: parameter `s` of swf_write_trailer
  471. }
  472. 
  473. static int swf_write_trailer(AVFormatContext *s)
       ^
  474. {
  475.     SWFContext *swf = s->priv_data;

libavformat/swfenc.c:475:5: assigned
  473. static int swf_write_trailer(AVFormatContext *s)
  474. {
  475.     SWFContext *swf = s->priv_data;
           ^
  476.     ByteIOContext *pb = s->pb;
  477.     AVCodecContext *enc, *video_enc;

libavformat/swfenc.c:486:13: when calling `av_fifo_free` here
  484.             video_enc = enc;
  485.         else
  486.             av_fifo_free(swf->audio_fifo);
                   ^
  487.     }
  488. 

libavutil/fifo.c:38:1: parameter `f` of av_fifo_free
    36. }
    37. 
    38. void av_fifo_free(AVFifoBuffer *f)
        ^
    39. {
    40.     if(f){

libavutil/fifo.c:42:9: when calling `av_free` here
    40.     if(f){
    41.         av_free(f->buffer);
    42.         av_free(f);
                ^
    43.     }
    44. }

libavutil/mem.c:122:1: parameter `ptr` of av_free
      120. }
      121. 
      122. void av_free(void *ptr)
           ^
      123. {
      124.     /* XXX: this test should not be needed on most libcs */

libavutil/mem.c:129:9: invalid access occurs here
      127.         free((char*)ptr - ((char*)ptr)[-1]);
      128. #else
      129.         free(ptr);
                   ^
      130. #endif
      131. }

void av_free(void *ptr)
{
    if (ptr)
#if CONFIG_MEMALIGN_HACK
        free((char*)ptr - ((char*)ptr)[-1]);
#else
        free(ptr);
#endif
}
['static int swf_write_trailer(AVFormatContext *s)\n{\n    SWFContext *swf = s->priv_data;\n    ByteIOContext *pb = s->pb;\n    AVCodecContext *enc, *video_enc;\n    int file_size, i;\n    video_enc = NULL;\n    for(i=0;i<s->nb_streams;i++) {\n        enc = s->streams[i]->codec;\n        if (enc->codec_type == CODEC_TYPE_VIDEO)\n            video_enc = enc;\n        else\n            av_fifo_free(swf->audio_fifo);\n    }\n    put_swf_tag(s, TAG_END);\n    put_swf_end_tag(s);\n    put_flush_packet(s->pb);\n    if (!url_is_streamed(s->pb) && video_enc) {\n        file_size = url_ftell(pb);\n        url_fseek(pb, 4, SEEK_SET);\n        put_le32(pb, file_size);\n        url_fseek(pb, swf->duration_pos, SEEK_SET);\n        put_le16(pb, swf->video_frame_number);\n        url_fseek(pb, swf->vframes_pos, SEEK_SET);\n        put_le16(pb, swf->video_frame_number);\n        url_fseek(pb, file_size, SEEK_SET);\n    }\n    return 0;\n}', 'void av_fifo_free(AVFifoBuffer *f)\n{\n    if(f){\n        av_free(f->buffer);\n        av_free(f);\n    }\n}', 'void av_free(void *ptr)\n{\n    if (ptr)\n#if CONFIG_MEMALIGN_HACK\n        free((char*)ptr - ((char*)ptr)[-1]);\n#else\n        free(ptr);\n#endif\n}']