Remove redundant NULL checks.

Remove NULL checks before free() because free(NULL) performs no operation.