From 5e4dd0c0197f6273c61491a5b9a030c93f796a12 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 2 Nov 2024 15:55:58 +0100 Subject: add some tests --- backend/String.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backend/String.cpp') diff --git a/backend/String.cpp b/backend/String.cpp index e5512bf..84dc2ec 100644 --- a/backend/String.cpp +++ b/backend/String.cpp @@ -26,7 +26,7 @@ String::String(String && other) { } String & String::operator = (String && other) { if (this == &other) return *this; - safe_free(this->_data); + safe_free(&this->_data); this->_data = other._data; this->_data_len = other._data_len; other._data = nullptr; @@ -58,14 +58,14 @@ String String::va_fmt(va_list args, const char * fmt) { out._data_len = vsnprintf(NULL, 0, fmt, args_copy); va_end(args_copy); - safe_free(out._data); + safe_free(&out._data); out._data = static_cast(malloc(out._data_len + 1)); vsnprintf(out._data, out._data_len + 1, fmt, args); return out; } String::~String() { - safe_free(this->_data); + safe_free(&this->_data); } void String::set(const char * data) { @@ -73,7 +73,7 @@ void String::set(const char * data) { } void String::set(const char * data, size_t data_len) { - safe_free(this->_data); + safe_free(&this->_data); this->_data = static_cast(malloc(data_len + 1)); this->_data_len = data_len; memcpy(this->_data, data, data_len); -- cgit v1.2.3