summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2021-02-23 17:08:49 +0200
committerOran Agra <oran@redislabs.com>2021-03-02 08:11:51 +0200
commit993cf62c778aa3dd5befd6fa03d92f5f3608ef60 (patch)
tree10e6c09b3596ae1a3f6ae4a65f02d8ce91074b68
parent562787e4c9953a8780c925238c409adc9316d3dc (diff)
downloadredis-993cf62c778aa3dd5befd6fa03d92f5f3608ef60.tar.gz
Fix compile errors with no HAVE_MALLOC_SIZE. (#8533)
Also adds a new daily CI test, relying on the fact that we don't use malloc_size() on alpine libmusl. Fixes #8531 (cherry picked from commit dd885780d67f18f356a5652ab6d4f947ee035305)
-rw-r--r--src/zmalloc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 29e68180f..7f9131f27 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+#include <assert.h>
/* This function provide us access to the original libc free(). This is useful
* for instance to free results obtained by backtrace_symbols(). We need
@@ -48,18 +49,14 @@ void zlibc_free(void *ptr) {
#ifdef HAVE_MALLOC_SIZE
#define PREFIX_SIZE (0)
+#define ASSERT_NO_SIZE_OVERFLOW(sz)
#else
#if defined(__sun) || defined(__sparc) || defined(__sparc__)
#define PREFIX_SIZE (sizeof(long long))
#else
#define PREFIX_SIZE (sizeof(size_t))
#endif
-#endif
-
-#if PREFIX_SIZE > 0
#define ASSERT_NO_SIZE_OVERFLOW(sz) assert((sz) + PREFIX_SIZE > (sz))
-#else
-#define ASSERT_NO_SIZE_OVERFLOW(sz)
#endif
/* Explicitly override malloc/free etc when using tcmalloc. */