Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 038d7af

Browse files
committed
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.
1 parent 40f6f22 commit 038d7af

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/signature.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
7979
GITERR_CHECK_ALLOC(p);
8080

8181
p->name = extract_trimmed(name, strlen(name));
82+
GITERR_CHECK_ALLOC(p->name);
8283
p->email = extract_trimmed(email, strlen(email));
83-
84-
if (p->name == NULL || p->email == NULL)
85-
return -1; /* oom */
84+
GITERR_CHECK_ALLOC(p->email);
8685

8786
if (p->name[0] == '\0' || p->email[0] == '\0') {
8887
git_signature_free(p);

0 commit comments

Comments
 (0)