From 2bd4d3c39ccb0e930d4ed04463f153047909eebd Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 21 Nov 2024 11:01:00 -0500 Subject: [PATCH 1/2] [c++] Fix heap corruption in `fastercsx` --- libtiledbsoma/src/external/include/thread_pool/status.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtiledbsoma/src/external/include/thread_pool/status.h b/libtiledbsoma/src/external/include/thread_pool/status.h index 4c1a13c3f4..7ba9ab40c7 100644 --- a/libtiledbsoma/src/external/include/thread_pool/status.h +++ b/libtiledbsoma/src/external/include/thread_pool/status.h @@ -59,7 +59,7 @@ #define tdb_delete_array(p) \ if (p) { \ - delete[] p; \ + free((void *)p); \ } #define tdb_new_array(T, size) (T*)malloc(size * sizeof(T)) From c74ca98b881f0ec588b65c8c08b1a4e0cd195768 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 21 Nov 2024 12:34:45 -0500 Subject: [PATCH 2/2] switch from `malloc`/`free` to `new[]`/`delete[]` --- libtiledbsoma/src/external/include/thread_pool/status.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libtiledbsoma/src/external/include/thread_pool/status.h b/libtiledbsoma/src/external/include/thread_pool/status.h index 7ba9ab40c7..68c9153b0b 100644 --- a/libtiledbsoma/src/external/include/thread_pool/status.h +++ b/libtiledbsoma/src/external/include/thread_pool/status.h @@ -59,9 +59,9 @@ #define tdb_delete_array(p) \ if (p) { \ - free((void *)p); \ + delete[] p; \ } -#define tdb_new_array(T, size) (T*)malloc(size * sizeof(T)) +#define tdb_new_array(T, size) (new T[size]) namespace tiledbsoma {