MAINT: C fixes

Two very minor patches.
Actually there are no memory leaks, I misread the code. However: the allocation of each `params[kk]` is conditional, but when it's not needed, the pointer is not set to `NULL` but left to whatever garbage `malloc` produced, so it's a bit of a miracle that this hasn't segfaulted more often.