signature: use GITERR_CHECK_ALLOC to check for OOM situation

When checking for out of memory situations we usually use the
GITERR_CHECK_ALLOC macro. Besides conforming to our current code
base it adds the benefit of silencing errors in Coverity due to
Coverity handling the macro's error path as abort.
This commit is contained in:
Patrick Steinhardt 2016-02-15 11:30:48 +01:00
parent 40f6f22517
commit 038d7af085

View File

@ -79,10 +79,9 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
GITERR_CHECK_ALLOC(p); GITERR_CHECK_ALLOC(p);
p->name = extract_trimmed(name, strlen(name)); p->name = extract_trimmed(name, strlen(name));
GITERR_CHECK_ALLOC(p->name);
p->email = extract_trimmed(email, strlen(email)); p->email = extract_trimmed(email, strlen(email));
GITERR_CHECK_ALLOC(p->email);
if (p->name == NULL || p->email == NULL)
return -1; /* oom */
if (p->name[0] == '\0' || p->email[0] == '\0') { if (p->name[0] == '\0' || p->email[0] == '\0') {
git_signature_free(p); git_signature_free(p);