Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-11-13 07:02:28 +0400
committerBen Straub <bs@github.com>2013-11-13 07:02:28 +0400
commitb20c40a8d6127a3ee9b807b2243e41bc8e85124c (patch)
tree192113edc4da9f30b9b5ca1679db38f668ebbf96 /src/signature.c
parent9db56cc4a78ee7799450cd3838af12124ccc4e8e (diff)
Don't leak memory when duplicating a NULL signature
Diffstat (limited to 'src/signature.c')
-rw-r--r--src/signature.c6
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;