[Scummvm-git-logs] scummvm master -> 06acfd515f2e210b8f0b0e628b107db785fcd692

criezy criezy at scummvm.org
Mon Sep 30 23:06:45 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
06acfd515f COMMON: Fix memory leaks in iconv error case


Commit: 06acfd515f2e210b8f0b0e628b107db785fcd692
    https://github.com/scummvm/scummvm/commit/06acfd515f2e210b8f0b0e628b107db785fcd692
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-09-30T22:04:27+01:00

Commit Message:
COMMON: Fix memory leaks in iconv error case

This fixes coverity CID 1405783 and CID 1405784.

Changed paths:
    common/encoding.cpp


diff --git a/common/encoding.cpp b/common/encoding.cpp
index 3c70f19..46faebe 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;
 	}





More information about the Scummvm-git-logs mailing list