summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2021-02-23 17:08:49 +0200
committerGitHub <noreply@github.com>2021-02-23 17:08:49 +0200
commitdd885780d67f18f356a5652ab6d4f947ee035305 (patch)
treea2fea05b0a3c69155edf70adc24533c3f2486c25
parent95ea74549cc454d6d6a7462b366462589cd96712 (diff)
downloadredis-dd885780d67f18f356a5652ab6d4f947ee035305.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
-rw-r--r--.github/workflows/daily.yml22
-rw-r--r--src/zmalloc.c7
2 files changed, 23 insertions, 6 deletions
diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml
index 6aa535c5e..9b9d15988 100644
--- a/.github/workflows/daily.yml
+++ b/.github/workflows/daily.yml
@@ -222,7 +222,7 @@ jobs:
./runtest-sentinel &&
./runtest-cluster
- test-alpine:
+ test-alpine-jemalloc:
runs-on: ubuntu-latest
container: alpine:latest
steps:
@@ -241,3 +241,23 @@ jobs:
run: ./runtest-sentinel
- name: cluster tests
run: ./runtest-cluster
+
+ test-alpine-libc-malloc:
+ runs-on: ubuntu-latest
+ container: alpine:latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: make
+ run: |
+ apk add build-base
+ make REDIS_CFLAGS='-Werror' USE_JEMALLOC=no
+ - name: test
+ run: |
+ apk add tcl procps
+ ./runtest --accurate --verbose --dump-logs
+ - name: module api test
+ run: ./runtest-moduleapi --verbose
+ - name: sentinel tests
+ run: ./runtest-sentinel
+ - name: cluster tests
+ run: ./runtest-cluster
diff --git a/src/zmalloc.c b/src/zmalloc.c
index c8d6c825f..fbac09616 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <unistd.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
@@ -49,18 +50,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. */