[libxml2] Fix memory leak in xmlFindCharEncodingHandler
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix memory leak in xmlFindCharEncodingHandler
- Date: Sat, 5 Mar 2022 17:38:09 +0000 (UTC)
commit f2072a8b2fcfcf6ca30b9eae8d4e9a10c61192bd
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Sat Mar 5 18:23:34 2022 +0100
Fix memory leak in xmlFindCharEncodingHandler
Fix memory leak in an unlikely error condition. Thanks to Wentao Liang
for the report.
Fixes #342.
encoding.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/encoding.c b/encoding.c
index 951c5285..fc5373c4 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1747,6 +1747,10 @@ xmlFindCharEncodingHandler(const char *name) {
} else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) {
xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
"iconv : problems with filters for '%s'\n", name);
+ if (icv_in != (iconv_t) -1)
+ iconv_close(icv_in);
+ else
+ iconv_close(icv_out);
}
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]