Skip to content

Commit 9f24026

Browse files
committed
Fixed mismatched delete/delete[]
1 parent 1bf25e0 commit 9f24026

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/oup/observable_unique_ptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ observable_sealed_ptr<T> make_observable_sealed(Args&& ... args) {
772772
// Allocate memory
773773
constexpr std::size_t block_size = sizeof(block_type);
774774
constexpr std::size_t object_size = sizeof(T);
775-
std::byte* buffer = new std::byte[block_size + object_size];
775+
std::byte* buffer = reinterpret_cast<std::byte*>(operator new(block_size + object_size));
776776

777777
try {
778778
// Construct control block and object
@@ -784,7 +784,7 @@ observable_sealed_ptr<T> make_observable_sealed(Args&& ... args) {
784784
} catch (...) {
785785
// Exception thrown during object construction,
786786
// clean up memory and let exception propagate
787-
delete[] buffer;
787+
delete buffer;
788788
throw;
789789
}
790790
}

0 commit comments

Comments
 (0)