From e7234ec4679c70a2f79e60ecb6f7a6fac1772fca Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 27 Aug 2019 13:05:26 +0200 Subject: Merge alloc_flex conditionals into one It is shorter and less confusing for coverity. Signed-off-by: David Oberhollenzer --- lib/util/alloc.c | 8 ++------ 1 file 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; } -- cgit v1.2.3