mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-25 10:50:08 +03:00
malloc-fail: Fix memory leak in xmlOutputBufferCreateFilename
Close encoding handler on error.
This commit is contained in:
parent
02fcb1effb
commit
36ea881b9d
12
xmlIO.c
12
xmlIO.c
@ -1523,11 +1523,12 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
||||
*/
|
||||
if (puri->scheme == NULL) {
|
||||
unescaped = xmlURIUnescapeString(URI, 0, NULL);
|
||||
if (unescaped == NULL) {
|
||||
xmlFreeURI(puri);
|
||||
return(NULL);
|
||||
}
|
||||
URI = unescaped;
|
||||
if (unescaped == NULL) {
|
||||
xmlFreeURI(puri);
|
||||
xmlCharEncCloseFunc(encoder);
|
||||
return(NULL);
|
||||
}
|
||||
URI = unescaped;
|
||||
}
|
||||
xmlFreeURI(puri);
|
||||
}
|
||||
@ -1538,6 +1539,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
||||
ret = xmlAllocOutputBufferInternal(encoder);
|
||||
if (ret == NULL) {
|
||||
xmlFree(unescaped);
|
||||
xmlCharEncCloseFunc(encoder);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user