From fe412ddfcb3b6584a88fc44e1341ab56e721d2bc Mon Sep 17 00:00:00 2001 From: Thomas Goodwin Date: Fri, 23 Feb 2024 10:46:39 -0500 Subject: [PATCH] fix compiler warning about mismatched allocator (#28) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The buffer(s) here are created with 'new' but free'd with 'free' when it should have been 'delete []', resulting in a compiler warning that may or may not cause issues. Signed-off-by: Thomas Goodwin Co-authored-by: sara boulé <91092144+saraboule@users.noreply.github.com> --- src/gsts3uploaderpartcache.hpp | 2 +- tests/check/uploaderpartcache.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gsts3uploaderpartcache.hpp b/src/gsts3uploaderpartcache.hpp index 9363e95..0eab61d 100644 --- a/src/gsts3uploaderpartcache.hpp +++ b/src/gsts3uploaderpartcache.hpp @@ -190,7 +190,7 @@ class UploaderPartCache { void clear_buffer() { if (_buffer) { - free(_buffer); + delete [] _buffer; } _buffer = NULL; } diff --git a/tests/check/uploaderpartcache.cpp b/tests/check/uploaderpartcache.cpp index a1d89e8..9ee2d13 100644 --- a/tests/check/uploaderpartcache.cpp +++ b/tests/check/uploaderpartcache.cpp @@ -24,7 +24,7 @@ using gst::aws::s3::UploaderPartCache; #define TEST_BUFFER_NEW(s) (new char[s]) -#define TEST_BUFFER_FREE(b) {if (b) free(b); b = NULL;} +#define TEST_BUFFER_FREE(b) {if (b) delete [] b; b = NULL;} GST_START_TEST(test_part_info) { UploaderPartCache::PartInfo uut;