zmbv: check av_realloc() return values and avoid memleaks on ENOMEM