init: fix memory leak in error handling