I think the check of allocation failure for `c->publickey` (be it as is or via `GITERR_CHECK_ALLOC`) needs to come before the `memcpy()`.