1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-25 10:50:08 +03:00

malloc-fail: Fix null-deref with xmllint --copy

See #344. Fixes #552.
This commit is contained in:
Nick Wellnhofer 2023-06-06 13:15:46 +02:00
parent 6273df6c6d
commit 305a75ccbe

View File

@ -2399,6 +2399,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
startTimer();
}
doc = xmlCopyDoc(doc, 1);
if (doc == NULL) {
progresult = XMLLINT_ERR_MEM;
xmlFreeDoc(tmp);
return;
}
if (timing) {
endTimer("Copying");
}