sonic: use av_freep() as its safer than av_free()