cleanup: remove NULL checks before free() all over the code