diff --git a/src/libguac/mem.c b/src/libguac/mem.c index 8f9a842a6..06735bf00 100644 --- a/src/libguac/mem.c +++ b/src/libguac/mem.c @@ -17,6 +17,7 @@ * under the License. */ +#include "guacamole/assert.h" #include "guacamole/error.h" #include "guacamole/mem.h" #include "guacamole/private/mem.h" @@ -126,8 +127,7 @@ size_t PRIV_guac_mem_ckd_mul_or_die(size_t factor_count, const size_t* factors) /* Perform request multiplication, aborting the entire process if the * calculation overflows */ size_t result = 0; - if (PRIV_guac_mem_ckd_mul(&result, factor_count, factors)) - abort(); + GUAC_ASSERT(!PRIV_guac_mem_ckd_mul(&result, factor_count, factors)); return result; @@ -138,8 +138,7 @@ size_t PRIV_guac_mem_ckd_add_or_die(size_t term_count, const size_t* terms) { /* Perform request addition, aborting the entire process if the calculation * overflows */ size_t result = 0; - if (PRIV_guac_mem_ckd_add(&result, term_count, terms)) - abort(); + GUAC_ASSERT(!PRIV_guac_mem_ckd_add(&result, term_count, terms)); return result; @@ -150,8 +149,7 @@ size_t PRIV_guac_mem_ckd_sub_or_die(size_t term_count, const size_t* terms) { /* Perform request subtraction, aborting the entire process if the * calculation overflows */ size_t result = 0; - if (PRIV_guac_mem_ckd_sub(&result, term_count, terms)) - abort(); + GUAC_ASSERT(!PRIV_guac_mem_ckd_sub(&result, term_count, terms)); return result; @@ -238,8 +236,7 @@ void* PRIV_guac_mem_realloc_or_die(void* mem, size_t factor_count, const size_t* /* Perform requested resize, aborting the entire process if this cannot be * done */ void* resized_mem = PRIV_guac_mem_realloc(mem, factor_count, factors); - if (resized_mem == NULL && guac_error != GUAC_STATUS_SUCCESS) - abort(); + GUAC_ASSERT(resized_mem != NULL || guac_error == GUAC_STATUS_SUCCESS); return resized_mem;