mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-09 04:58:16 +03:00
Fix memory leak in xmlSwitchInputEncodingInt error path
Found by OSS-Fuzz.
This commit is contained in:
parent
1567b55b72
commit
3776cb4745
@ -1240,8 +1240,18 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
|
||||
* size to be able to convert the buffer.
|
||||
*/
|
||||
xmlErrInternal(ctxt, "switching encoding : no input\n", NULL);
|
||||
/*
|
||||
* Callers assume that the input buffer takes ownership of the
|
||||
* encoding handler. xmlCharEncCloseFunc frees unregistered
|
||||
* handlers and avoids a memory leak.
|
||||
*/
|
||||
xmlCharEncCloseFunc(handler);
|
||||
return (-1);
|
||||
}
|
||||
/*
|
||||
* We should actually raise an error here, see issue #34.
|
||||
*/
|
||||
xmlCharEncCloseFunc(handler);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user