wtv: clean memory on error