Re: [xml] [PATCH] encoding: fix memleak in xmlRegisterCharEncodingHandler()
- From: Nick Wellnhofer <wellnhofer aevum de>
- To: Xiaoming Ni <nixiaoming huawei com>, xml gnome org
- Cc: wangle6 huawei com, wuqing30 huawei com
- Subject: Re: [xml] [PATCH] encoding: fix memleak in xmlRegisterCharEncodingHandler()
- Date: Mon, 7 Dec 2020 15:00:27 +0100
On 07/12/2020 13:19, Xiaoming Ni wrote:
The return type of xmlRegisterCharEncodingHandler() is void. The invoker
cannot determine whether xmlRegisterCharEncodingHandler() is executed
successfully. when nbCharEncodingHandler >= MAX_ENCODING_HANDLERS, the
"handler" is not added to the array "handlers". As a result, the memory
of "handler" cannot be managed and released: memory leakage.
so add "xmlfree(handler)" to fix memory leakage on the failure branch of
xmlRegisterCharEncodingHandler().
Reported-by: wuqing <wuqing30 huawei com>
Signed-off-by: Xiaoming Ni <nixiaoming huawei com>
---
encoding.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Merged here:
https://gitlab.gnome.org/GNOME/libxml2/-/commit/649d02eaa419fa72ae6b131718a4ac77063d7a5a
Nick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]