From 0d38ce0e9ecb162a452d016bed0121ecd7627f2a Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 31 Dec 2023 16:49:27 +0100 Subject: [PATCH] oops --- src/common.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index 9846ea5..eb4050a 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -92,7 +92,7 @@ void CConfigValue::defaultFrom(SConfigDefaultValue& ref) { break; } case CONFIGDATATYPE_STR: { - if (!m_pData) + if (m_pData) free(m_pData); std::string str = std::any_cast(ref.data); m_pData = calloc(1, str.length() + 1); @@ -131,7 +131,8 @@ void CConfigValue::setFrom(std::any value) { break; } case CONFIGDATATYPE_STR: { - free(m_pData); + if (m_pData) + free(m_pData); std::string str = std::any_cast(value); m_pData = calloc(1, str.length() + 1); strncpy((char*)m_pData, str.c_str(), str.length());