MAINT: C fixes

Two very minor patches.
`free(NULL)` is defined to be a no-op in C89, so `if (p) { free(p); }` is always equivalent to just `free(p);`