core: Don't leak memory if error is unknown