aboutsummaryrefslogtreecommitdiffstats
path: root/libtest
diff options
context:
space:
mode:
Diffstat (limited to 'libtest')
-rw-r--r--libtest/common.h5
-rw-r--r--libtest/libtest_fd_tracking.c2
-rw-r--r--libtest/libtest_free.c2
3 files changed, 7 insertions, 2 deletions
diff --git a/libtest/common.h b/libtest/common.h
index ed9272e..ab59bab 100644
--- a/libtest/common.h
+++ b/libtest/common.h
@@ -34,6 +34,9 @@
# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* completely broken warning */
# pragma clang diagnostic ignored "-Wdisabled-macro-expansion" /* clang is being silly: it is common practice, and it complains about libc code */
#endif
+#if defined(__GNUC__)
+# pragma GCC diagnostic ignored "-Winline"
+#endif
#include "libtest.h"
@@ -229,6 +232,7 @@ void *__mremap(void *, size_t, size_t, int, ...);
#define assert(EXPR)\
do {\
+ atomic_thread_fence(memory_order_seq_cst);\
if (!(EXPR)) {\
libtest_malloc_internal_usage++;\
fprintf(stderr, "Assetion failure at %s:%i: %s\n", __FILE__, __LINE__, #EXPR);\
@@ -299,6 +303,7 @@ void *__mremap(void *, size_t, size_t, int, ...);
# define EXPECT(EXPR)\
do {\
+ atomic_thread_fence(memory_order_seq_cst);\
if (!(EXPR)) {\
libtest_malloc_internal_usage++;\
fprintf(stderr, "Failure at %s:%i: %s\n", __FILE__, __LINE__, #EXPR);\
diff --git a/libtest/libtest_fd_tracking.c b/libtest/libtest_fd_tracking.c
index 0dd69d2..81bd9cd 100644
--- a/libtest/libtest_fd_tracking.c
+++ b/libtest/libtest_fd_tracking.c
@@ -134,11 +134,11 @@ next:
new_nopened = 0u;
}
+ free(opened);
if (action >= 0) {
opened = new_opened;
nopened = new_nopened;
} else {
- free(opened);
opened = NULL;
nopened = 0u;
}
diff --git a/libtest/libtest_free.c b/libtest/libtest_free.c
index 396c716..5592e0a 100644
--- a/libtest/libtest_free.c
+++ b/libtest/libtest_free.c
@@ -74,7 +74,7 @@ libtest_free(void *ptr, enum libtest_zero_check zero_checking)
#ifdef WITH_BACKTRACE
if (!inside_free && getenv("TRACE_MALLOC")) {
inside_free = 1;
- fprintf(stderr, "Memory deallocated: %p\n (alloc-size=%zu, real-size=%zu)",
+ fprintf(stderr, "Memory deallocated: %p (alloc-size=%zu, real-size=%zu)\n",
ptr, mem->requested_alloc_size, mem->real_alloc_size);
if (getenv("TRACE_FREE") && !getenv("PRETRACE_FREE"))
libtest_print_backtrace(stderr, NULL, "\tat ", 0u, NULL, NULL);