summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-02-11 09:39:38 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2015-02-12 22:54:47 -0500
commit2884cc42de8b20a58cec8488d014a853d47c047e (patch)
tree19dbb80072107fe65c7dd1de5dd849cc6914b154 /src/tree.c
parent4aa664ae3953d99c2ae4cd769f02818bc122eebc (diff)
downloadlibgit2-2884cc42de8b20a58cec8488d014a853d47c047e.tar.gz
overflow checking: don't make callers set oom
Have the ALLOC_OVERFLOW testing macros also simply set_oom in the case where a computation would overflow, so that callers don't need to.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/tree.c b/src/tree.c
index 2c8b89291..573e56447 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -89,10 +89,8 @@ static git_tree_entry *alloc_entry(const char *filename)
if (GIT_ALLOC_OVERFLOW_ADD(tree_len, filename_len) ||
GIT_ALLOC_OVERFLOW_ADD(tree_len + filename_len, 1) ||
- !(entry = git__malloc(tree_len + filename_len + 1))) {
- giterr_set_oom();
+ !(entry = git__malloc(tree_len + filename_len + 1)))
return NULL;
- }
memset(entry, 0x0, sizeof(git_tree_entry));
memcpy(entry->filename, filename, filename_len);