Reduce memory needed by ASAN morgue

This commit is contained in:
Justine Tunney 2021-08-19 09:24:26 -07:00
parent d5a37de435
commit ed485391da
5 changed files with 34 additions and 10 deletions

View file

@ -594,7 +594,10 @@ static void __asan_deallocate(char *p, long kind) {
WRITE64BE(p + c - 8, kind);
__asan_poison((uintptr_t)p, c - 8, kind);
if (weaken(dlfree)) {
weaken(dlfree)(__asan_morgue_add(p));
if (c <= FRAMESIZE) {
p = __asan_morgue_add(p);
}
weaken(dlfree)(p);
}
} else {
__asan_report_heap_fault(p, n);

View file

@ -24,7 +24,7 @@
*
* @param mode may be _IOFBF, _IOLBF, or _IONBF
* @param buf may optionally be non-NULL to set the stream's underlying
* buffer, which the stream will own, but won't free, otherwise the
* buffer which the caller still owns and won't free, otherwise the
* existing buffer is used
* @param size is ignored if buf is NULL
* @return 0 on success or -1 on error