summaryrefslogtreecommitdiffstats
path: root/src/jemalloc.c
diff options
context:
space:
mode:
authorGarrett Cooper <yanegomi@gmail.com>2012-12-03 01:56:25 (GMT)
committerJason Evans <jasone@canonware.com>2012-12-24 18:30:57 (GMT)
commit6e6164ae159d9c3bd4f44bd2cba6fc3237687c80 (patch)
tree1a0ffba50417bed87300ce80c5b774216d860a6b /src/jemalloc.c
parent5135e34062584f67ae2d12b1f3940a9fad32ca9f (diff)
downloadjemalloc-6e6164ae159d9c3bd4f44bd2cba6fc3237687c80.zip
jemalloc-6e6164ae159d9c3bd4f44bd2cba6fc3237687c80.tar.gz
jemalloc-6e6164ae159d9c3bd4f44bd2cba6fc3237687c80.tar.bz2
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>
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r--src/jemalloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index cecd012..ec88700 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -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