MAINT remove unnecessary NULL check before free()

See 8708ad91fffd972313f4bf97a93869e57b058767 for rationale.
MAINT const for strings in TNC

This is just cleanup, not a semantic change.
MAINT: ndimage: malloc casts, NULL checks before free

See 8708ad91fffd972313f4bf97a93869e57b058767 for rationale.
Merge pull request #4246 from larsmans/c-fixes

MAINT: C fixes