mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-25 10:50:08 +03:00
xmllint: Report malloc failures from parsing patterns
This commit is contained in:
parent
255fd5f3f1
commit
bf1d8b9cfb
14
xmllint.c
14
xmllint.c
@ -3405,12 +3405,16 @@ xmllintMain(int argc, const char **argv, FILE *errStream,
|
||||
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
|
||||
if ((lint->pattern != NULL) && (lint->walker == 0)) {
|
||||
lint->patternc = xmlPatterncompile(BAD_CAST lint->pattern, NULL, 0,
|
||||
NULL);
|
||||
res = xmlPatternCompileSafe(BAD_CAST lint->pattern, NULL, 0, NULL,
|
||||
&lint->patternc);
|
||||
if (lint->patternc == NULL) {
|
||||
fprintf(errStream, "Pattern %s failed to compile\n",
|
||||
lint->pattern);
|
||||
lint->progresult = XMLLINT_ERR_SCHEMAPAT;
|
||||
if (res < 0) {
|
||||
lint->progresult = XMLLINT_ERR_MEM;
|
||||
} else {
|
||||
fprintf(errStream, "Pattern %s failed to compile\n",
|
||||
lint->pattern);
|
||||
lint->progresult = XMLLINT_ERR_SCHEMAPAT;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user