Re: [PATCH] encoding: fix memleak in xmlRegisterCharEncodingHandler()

Nick Wellnhofer via xml <[email protected]> Mon, 7 Dec 2020 15:00:27 +0100
Newsgroups gmane.comp.gnome.lib.xml.general
Message-ID <[email protected]>
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 <[email protected]>
> Signed-off-by: Xiaoming Ni <[email protected]>
> ---
>   encoding.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)

Merged here: 
https://gitlab.gnome.org/GNOME/libxml2/-/commit/649d02eaa419fa72ae6b131718a4ac77063d7a5a

Nick

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml