From b9fab94dbf6515580ca471547bcd3ee06870f75e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 27 Apr 2020 23:51:56 +0200 Subject: [PATCH] COMMON: Shut coverity up with tons of false positives --- common/str.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/str.cpp b/common/str.cpp index a60718075ee..2ae366bca8e 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -229,7 +229,12 @@ void String::decRefCount(int *oldRefCount) { g_refCountPool->freeChunk(oldRefCount); unlockMemoryPoolMutex(); } + // Coverity thinks that we always free memory, as it assumes + // (correctly) that there are cases when oldRefCount == 0 + // Thus, DO NOT COMPILE, trick it and shut tons of false positives +#ifndef __COVERITY__ delete[] _str; +#endif // Even though _str points to a freed memory block now, // we do not change its value, because any code that calls