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

Signed-off-by: Garrett Cooper <[email protected]>
---
 src/jemalloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/jemalloc.c b/src/jemalloc.c
index 8a667b6..ec3805c 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
--
1.8.0

_______________________________________________
jemalloc-discuss mailing list
[email protected]
http://www.canonware.com/mailman/listinfo/jemalloc-discuss

Reply via email to