From dfdd568974ae77826319840545ca6ed80da3df48 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 22 Jun 2022 14:43:53 -0400 Subject: [PATCH] use unique_ptr --- include/common/bspfile_generic.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/bspfile_generic.hh b/include/common/bspfile_generic.hh index 382560a2..e13e913b 100644 --- a/include/common/bspfile_generic.hh +++ b/include/common/bspfile_generic.hh @@ -187,9 +187,9 @@ public: stream.seekg(static_cast(start) + dtex.offsets[g]); const size_t num_bytes = (dtex.width >> g) * (dtex.height >> g); - uint8_t *bytes = new uint8_t[num_bytes]; + std::unique_ptr bytes = std::make_unique(num_bytes); stream.read(reinterpret_cast(bytes), num_bytes); - data[g] = std::unique_ptr(bytes); + data[g].swap(bytes); } }