From 06acfd515f2e210b8f0b0e628b107db785fcd692 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 30 Sep 2019 22:02:05 +0100 Subject: COMMON: Fix memory leaks in iconv error case This fixes coverity CID 1405783 and CID 1405784. --- common/encoding.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/encoding.cpp b/common/encoding.cpp index 3c70f19334..46faebe313 100644 --- a/common/encoding.cpp +++ b/common/encoding.cpp @@ -197,6 +197,10 @@ char *Encoding::convertIconv(const char *to, const char *from, const char *strin char *buffer = (char *) calloc(sizeof(char), stringSize); if (!buffer) { +#ifndef ICONV_USES_CONST + delete[] originalSrc; +#endif // ICONV_USES_CONST + iconv_close(iconvHandle); warning ("Cannot allocate memory for converting string"); return nullptr; } -- cgit v1.2.3