|
@ -0,0 +1,43 @@ |
|
|
|
|
|
From dd885780d67f18f356a5652ab6d4f947ee035305 Mon Sep 17 00:00:00 2001 |
|
|
|
|
|
From: Yossi Gottlieb <yossigo@gmail.com> |
|
|
|
|
|
Date: Tue, 23 Feb 2021 17:08:49 +0200 |
|
|
|
|
|
Subject: [PATCH] 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 |
|
|
|
|
|
---
|
|
|
|
|
|
.github/workflows/daily.yml | 22 +++++++++++++++++++++- |
|
|
|
|
|
src/zmalloc.c | 7 ++----- |
|
|
|
|
|
2 files changed, 23 insertions(+), 6 deletions(-) |
|
|
|
|
|
|
|
|
|
|
|
--- 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. */ |