diff options
author | Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com> | 2024-03-11 10:29:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-11 10:29:46 -0500 |
commit | cd5504637beb1aafeeec08fd339e0e920386eea1 (patch) | |
tree | fa9f302457a1072c86b1e94ffc841c71f372bd93 /flang/unittests | |
parent | 9b1c496898cbefdce74eb1cf1a0911eb3230d65b (diff) | |
download | llvm-cd5504637beb1aafeeec08fd339e0e920386eea1.zip llvm-cd5504637beb1aafeeec08fd339e0e920386eea1.tar.gz llvm-cd5504637beb1aafeeec08fd339e0e920386eea1.tar.bz2 |
[flang][unittests] Use malloc when memory will be deallcated with free (#84380)
Runtime unit tests used `new[]` to allocate memory, which then was
released using `free`.
This was detected by address sanitizer.
Diffstat (limited to 'flang/unittests')
-rw-r--r-- | flang/unittests/Runtime/Ragged.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/flang/unittests/Runtime/Ragged.cpp b/flang/unittests/Runtime/Ragged.cpp index 4b261b1..5049bc8 100644 --- a/flang/unittests/Runtime/Ragged.cpp +++ b/flang/unittests/Runtime/Ragged.cpp @@ -14,7 +14,7 @@ using namespace Fortran::runtime; TEST(Ragged, RaggedArrayAllocateDeallocateTest) { struct RaggedArrayHeader header; unsigned rank = 2; - int64_t *extents = new int64_t[2]; + int64_t *extents = reinterpret_cast<int64_t *>(malloc(2 * sizeof(int64_t))); extents[0] = 10; extents[1] = 100; RaggedArrayHeader *ret = (RaggedArrayHeader *)_FortranARaggedArrayAllocate( |