Use av_fast_malloc instead of av_realloc.