Basic error handling, cnf memory allocation