summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-27 13:05:26 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-27 13:05:26 +0200
commite7234ec4679c70a2f79e60ecb6f7a6fac1772fca (patch)
tree3f72a3e5b687aae219c8690578b213e672dd07c2 /lib/util
parentfa893f8f7c96f27828e8d5c694f85a44aa9f8b7b (diff)
Merge alloc_flex conditionals into one
It is shorter and less confusing for coverity. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/alloc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/util/alloc.c b/lib/util/alloc.c
index 2d748a7..8e1c4f1 100644
--- a/lib/util/alloc.c
+++ b/lib/util/alloc.c
@@ -16,12 +16,8 @@ void *alloc_flex(size_t base_size, size_t item_size, size_t nmemb)
{
size_t size;
- if (SZ_MUL_OV(nmemb, item_size, &size)) {
- errno = EOVERFLOW;
- return NULL;
- }
-
- if (SZ_ADD_OV(base_size, size, &size)) {
+ if (SZ_MUL_OV(nmemb, item_size, &size) ||
+ SZ_ADD_OV(base_size, size, &size)) {
errno = EOVERFLOW;
return NULL;
}