fix leaks on invalid frames