Maybe `GITERR_CHECK_ALLOC(ref);`?