diff options
author | Rich Felker <dalias@aerifal.cx> | 2020-06-10 22:05:03 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020-06-10 22:05:03 -0400 |
commit | 1fc67fc117f9d25d240d46bbef78ebccacec7097 (patch) | |
tree | d1d41909b507df72419ed769f2dc5e4522e4b29a /src/malloc/oldmalloc | |
parent | e9f4fd1185badfc005fcfe5c7de27d58baec057c (diff) | |
download | musl-1fc67fc117f9d25d240d46bbef78ebccacec7097.tar.gz musl-1fc67fc117f9d25d240d46bbef78ebccacec7097.tar.bz2 musl-1fc67fc117f9d25d240d46bbef78ebccacec7097.tar.xz musl-1fc67fc117f9d25d240d46bbef78ebccacec7097.zip |
only disable aligned_alloc if malloc was replaced but it wasn't
it both malloc and aligned_alloc have been replaced but the internal
aligned_alloc still gets called, the replacement is a wrapper of some
sort. it's not clear if this usage should be officially supported, but
it's at least a plausibly interesting debugging usage, and easy to do.
it should not be relied upon unless it's documented as supported at
some later time.
Diffstat (limited to 'src/malloc/oldmalloc')
-rw-r--r-- | src/malloc/oldmalloc/aligned_alloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/malloc/oldmalloc/aligned_alloc.c b/src/malloc/oldmalloc/aligned_alloc.c index e06c76ed..4adca3b4 100644 --- a/src/malloc/oldmalloc/aligned_alloc.c +++ b/src/malloc/oldmalloc/aligned_alloc.c @@ -12,7 +12,8 @@ void *aligned_alloc(size_t align, size_t len) return 0; } - if (len > SIZE_MAX - align || __malloc_replaced) { + if (len > SIZE_MAX - align || + (__malloc_replaced && !__aligned_alloc_replaced)) { errno = ENOMEM; return 0; } |