diff options
| author | Carlos Martín Nieto <cmn@elego.de> | 2011-04-07 14:38:03 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-04-09 15:27:16 -0700 |
| commit | 076141a137c411d970e4c9e0d725d91eac44e27c (patch) | |
| tree | 68e509c09e3a4e59791660f3bfbbcf6fb28bf8cd /src/signature.c | |
| parent | 4a34b3a9ff796f2324d59eb598595be62934acdf (diff) | |
| download | libgit2-076141a137c411d970e4c9e0d725d91eac44e27c.tar.gz | |
Add a few malloc checks
Add checks to see if malloc failed when allocating the tag members and
signature members.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/signature.c')
| -rw-r--r-- | src/signature.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/signature.c b/src/signature.c index 7c4397922..bd64652ca 100644 --- a/src/signature.c +++ b/src/signature.c @@ -140,6 +140,9 @@ int git_signature__parse(git_signature *sig, const char **buffer_out, name_length = name_end - buffer - 1; sig->name = git__malloc(name_length + 1); + if (sig->name == NULL) + return GIT_ENOMEM; + memcpy(sig->name, buffer, name_length); sig->name[name_length] = 0; buffer = name_end + 1; @@ -153,6 +156,9 @@ int git_signature__parse(git_signature *sig, const char **buffer_out, email_length = email_end - buffer; sig->email = git__malloc(email_length + 1); + if (sig->name == NULL) + return GIT_ENOMEM; + memcpy(sig->email, buffer, email_length); sig->email[email_length] = 0; buffer = email_end + 1; |
