You don't have to check for NULL. free(NULL) is well-defined.