From ad0c9936b14bbf8d345509d366ab082f06be52e5 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 26 Jul 2025 13:58:47 +0200 Subject: [PATCH] Fix a compiler warning Signed-off-by: falkTX --- distrho/extra/String.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/distrho/extra/String.hpp b/distrho/extra/String.hpp index 8a34e981..b7fda927 100644 --- a/distrho/extra/String.hpp +++ b/distrho/extra/String.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -1030,13 +1030,14 @@ public: } // we have some data ourselves, reallocate to add the new stuff - char* const newBuf = static_cast(std::realloc(fBuffer, fBufferLen + strBufLen + 1)); + char* const newBuf = static_cast(std::realloc(fBufferAlloc ? fBuffer : nullptr, fBufferLen + strBufLen + 1)); DISTRHO_SAFE_ASSERT_RETURN(newBuf != nullptr, *this); std::memcpy(newBuf + fBufferLen, strBuf, strBufLen + 1); fBuffer = newBuf; fBufferLen += strBufLen; + fBufferAlloc = true; return *this; }