Don't mangle errno with free(3) if utrace(2) fails

This ensures POLA on FreeBSD (at least) as free(3) is generally assumed
to not fiddle around with errno.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
This commit is contained in:
Garrett Cooper 2012-12-02 17:56:25 -08:00 committed by Jason Evans
parent 5135e34062
commit 6e6164ae15

View File

@ -83,11 +83,13 @@ typedef struct {
#ifdef JEMALLOC_UTRACE
# define UTRACE(a, b, c) do { \
if (opt_utrace) { \
int utrace_serrno = errno; \
malloc_utrace_t ut; \
ut.p = (a); \
ut.s = (b); \
ut.r = (c); \
utrace(&ut, sizeof(ut)); \
errno = utrace_serrno; \
} \
} while (0)
#else