Skip to content

Commit

Permalink
Fix compile errors with no HAVE_MALLOC_SIZE. (redis#8533)
Browse files Browse the repository at this point in the history
Also adds a new daily CI test, relying on the fact that we don't use malloc_size() on alpine libmusl.

Fixes redis#8531

(cherry picked from commit dd88578)
  • Loading branch information
yossigo authored and oranagra committed Mar 2, 2021
1 parent 562787e commit 993cf62
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/zmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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. */
Expand Down

0 comments on commit 993cf62

Please sign in to comment.