diff options
author | Thierry Crozat | 2019-09-30 22:02:05 +0100 |
---|---|---|
committer | Thierry Crozat | 2019-09-30 22:04:27 +0100 |
commit | 06acfd515f2e210b8f0b0e628b107db785fcd692 (patch) | |
tree | d24eb9ffd459f876b696bf76e59710645a925535 | |
parent | 8ff5014526691f05741853fd18971c299e9912c4 (diff) | |
download | scummvm-rg350-06acfd515f2e210b8f0b0e628b107db785fcd692.tar.gz scummvm-rg350-06acfd515f2e210b8f0b0e628b107db785fcd692.tar.bz2 scummvm-rg350-06acfd515f2e210b8f0b0e628b107db785fcd692.zip |
COMMON: Fix memory leaks in iconv error case
This fixes coverity CID 1405783 and CID 1405784.
-rw-r--r-- | common/encoding.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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; } |