Fixed a couple Clang warnings

Fixed some recently introduced "regressions" that trigger Clang warnings while building on OS X (`checkout.c` one is a real bug too).
As the name indicates, it's for checking the result of allocations. In the `else` branch, the name is set to NULL not because of a bad allocation, but because of bad input. This turns out to be worse than I wrote, since we're not setting an error mode. From the code, it looks like one of them must always be set, thus the `assert()` as it's a programming error, not something you can recover from.