mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2026-01-26 21:41:34 +03:00
writer: Add a few extra NULL checks to avoid memory leaks on corrupt writer path.
This commit is contained in:
@@ -1014,7 +1014,7 @@ xmlTextWriterStartElementNS(xmlTextWriter *writer,
|
||||
int sum;
|
||||
xmlChar *buf;
|
||||
|
||||
if ((writer == NULL) || (name == NULL) || (*name == '\0'))
|
||||
if ((writer == NULL) || (writer->nsstack == NULL) || (name == NULL) || (*name == '\0'))
|
||||
return -1;
|
||||
|
||||
buf = NULL;
|
||||
@@ -1759,7 +1759,7 @@ xmlTextWriterStartAttributeNS(xmlTextWriter *writer,
|
||||
xmlChar *buf;
|
||||
xmlTextWriterNsStackEntry *p;
|
||||
|
||||
if ((writer == NULL) || (name == NULL) || (*name == '\0'))
|
||||
if ((writer == NULL) || (writer->nsstack == NULL) || (name == NULL) || (*name == '\0'))
|
||||
return -1;
|
||||
|
||||
/* Handle namespace first in case of error */
|
||||
@@ -4167,6 +4167,9 @@ xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer)
|
||||
int count;
|
||||
int sum;
|
||||
|
||||
if ((writer == NULL) || (writer->nsstack == NULL))
|
||||
return -1;
|
||||
|
||||
sum = 0;
|
||||
while (!xmlListEmpty(writer->nsstack)) {
|
||||
xmlChar *namespaceURI = NULL;
|
||||
|
||||
Reference in New Issue
Block a user