diff options
author | Ben Straub <bs@github.com> | 2013-11-13 07:02:28 +0400 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-11-13 07:02:28 +0400 |
commit | b20c40a8d6127a3ee9b807b2243e41bc8e85124c (patch) | |
tree | 192113edc4da9f30b9b5ca1679db38f668ebbf96 /src/signature.c | |
parent | 9db56cc4a78ee7799450cd3838af12124ccc4e8e (diff) |
Don't leak memory when duplicating a NULL signature
Diffstat (limited to 'src/signature.c')
-rw-r--r-- | src/signature.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/signature.c b/src/signature.c index 52ca2b375..ec51a42e9 100644 --- a/src/signature.c +++ b/src/signature.c @@ -84,8 +84,12 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema git_signature *git_signature_dup(const git_signature *sig) { - git_signature *new = git__calloc(1, sizeof(git_signature)); + git_signature *new; + if (sig == NULL) + return NULL; + + new = git__calloc(1, sizeof(git_signature)); if (new == NULL) return NULL; |