diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-15 01:22:19 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-15 01:22:19 +0200 |
| commit | 68d6804a43dca2749a68a557e67b98e6005ead83 (patch) | |
| tree | 9c4137a48cd37ea423578d1ac3df6e3953cb2156 /libtest | |
| parent | Fix minor errors in the test and check that we are not writing out of bounds (diff) | |
| download | librecrypt-68d6804a43dca2749a68a557e67b98e6005ead83.tar.gz librecrypt-68d6804a43dca2749a68a557e67b98e6005ead83.tar.bz2 librecrypt-68d6804a43dca2749a68a557e67b98e6005ead83.tar.xz | |
Fix some minor issues
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libtest')
| -rw-r--r-- | libtest/common.h | 5 | ||||
| -rw-r--r-- | libtest/libtest_fd_tracking.c | 2 | ||||
| -rw-r--r-- | libtest/libtest_free.c | 2 |
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); |
