mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
get rid of all the perror() calls made in the library execution paths.
* DOCBparser.c HTMLparser.c c14n.c entities.c list.c parser.c parserInternals.c xmlIO.c: get rid of all the perror() calls made in the library execution paths. This should fix both #92059 and #92385 Daniel
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Thu Sep 5 13:29:47 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* DOCBparser.c HTMLparser.c c14n.c entities.c list.c
|
||||||
|
parser.c parserInternals.c xmlIO.c: get rid of all the
|
||||||
|
perror() calls made in the library execution paths. This
|
||||||
|
should fix both #92059 and #92385
|
||||||
|
|
||||||
Thu Sep 5 13:13:17 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
Thu Sep 5 13:13:17 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xmllint.c: memory leak reporting was broken after a change
|
* xmllint.c: memory leak reporting was broken after a change
|
||||||
|
36
DOCBparser.c
36
DOCBparser.c
@ -119,19 +119,20 @@ struct _docbElemDesc {
|
|||||||
* Generic function for accessing stacks in the Parser Context
|
* Generic function for accessing stacks in the Parser Context
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PUSH_AND_POP(scope, type, name) \
|
#define PUSH_AND_POP(scope, type, name) \
|
||||||
scope int docb##name##Push(docbParserCtxtPtr ctxt, type value) { \
|
scope int docb##name##Push(docbParserCtxtPtr ctxt, type value) { \
|
||||||
if (ctxt->name##Nr >= ctxt->name##Max) { \
|
if (ctxt->name##Nr >= ctxt->name##Max) { \
|
||||||
ctxt->name##Max *= 2; \
|
ctxt->name##Max *= 2; \
|
||||||
ctxt->name##Tab = (type *) xmlRealloc(ctxt->name##Tab, \
|
ctxt->name##Tab = (type *) xmlRealloc(ctxt->name##Tab, \
|
||||||
ctxt->name##Max * sizeof(ctxt->name##Tab[0])); \
|
ctxt->name##Max * sizeof(ctxt->name##Tab[0])); \
|
||||||
if (ctxt->name##Tab == NULL) { \
|
if (ctxt->name##Tab == NULL) { \
|
||||||
xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); \
|
xmlGenericError(xmlGenericErrorContext, \
|
||||||
|
"realloc failed !\n"); \
|
||||||
return(0); \
|
return(0); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
ctxt->name##Tab[ctxt->name##Nr] = value; \
|
ctxt->name##Tab[ctxt->name##Nr] = value; \
|
||||||
ctxt->name = value; \
|
ctxt->name = value; \
|
||||||
return(ctxt->name##Nr++); \
|
return(ctxt->name##Nr++); \
|
||||||
} \
|
} \
|
||||||
scope type docb##name##Pop(docbParserCtxtPtr ctxt) { \
|
scope type docb##name##Pop(docbParserCtxtPtr ctxt) { \
|
||||||
@ -2049,10 +2050,10 @@ docbookEntitiesTable[] = {
|
|||||||
* Macro used to grow the current buffer.
|
* Macro used to grow the current buffer.
|
||||||
*/
|
*/
|
||||||
#define growBuffer(buffer) { \
|
#define growBuffer(buffer) { \
|
||||||
buffer##_size *= 2; \
|
buffer##_size *= 2; \
|
||||||
buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
||||||
if (buffer == NULL) { \
|
if (buffer == NULL) { \
|
||||||
perror("realloc failed"); \
|
xmlGenericError(xmlGenericErrorContext, "realloc failed"); \
|
||||||
return(NULL); \
|
return(NULL); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -2678,7 +2679,8 @@ docbParseSGMLAttribute(docbParserCtxtPtr ctxt, const xmlChar stop) {
|
|||||||
buffer_size = DOCB_PARSER_BIG_BUFFER_SIZE;
|
buffer_size = DOCB_PARSER_BIG_BUFFER_SIZE;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("docbParseSGMLAttribute: malloc failed");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"docbParseSGMLAttribute: malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
out = buffer;
|
out = buffer;
|
||||||
@ -5001,15 +5003,15 @@ docbCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
|
|||||||
|
|
||||||
ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
|
ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
|
||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
docbInitParserCtxt(ctxt);
|
docbInitParserCtxt(ctxt);
|
||||||
input = (docbParserInputPtr) xmlMalloc(sizeof(docbParserInput));
|
input = (docbParserInputPtr) xmlMalloc(sizeof(docbParserInput));
|
||||||
if (input == NULL) {
|
if (input == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed");
|
||||||
xmlFree(ctxt);
|
xmlFree(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(input, 0, sizeof(docbParserInput));
|
memset(input, 0, sizeof(docbParserInput));
|
||||||
|
|
||||||
@ -6010,16 +6012,16 @@ docbCreateFileParserCtxt(const char *filename,
|
|||||||
|
|
||||||
ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
|
ctxt = (docbParserCtxtPtr) xmlMalloc(sizeof(docbParserCtxt));
|
||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ctxt, 0, sizeof(docbParserCtxt));
|
memset(ctxt, 0, sizeof(docbParserCtxt));
|
||||||
docbInitParserCtxt(ctxt);
|
docbInitParserCtxt(ctxt);
|
||||||
inputStream = (docbParserInputPtr) xmlMalloc(sizeof(docbParserInput));
|
inputStream = (docbParserInputPtr) xmlMalloc(sizeof(docbParserInput));
|
||||||
if (inputStream == NULL) {
|
if (inputStream == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed");
|
||||||
xmlFree(ctxt);
|
xmlFree(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(inputStream, 0, sizeof(docbParserInput));
|
memset(inputStream, 0, sizeof(docbParserInput));
|
||||||
|
|
||||||
|
85
HTMLparser.c
85
HTMLparser.c
@ -1325,9 +1325,9 @@ static const htmlEntityDesc html40EntitiesTable[] = {
|
|||||||
*/
|
*/
|
||||||
#define growBuffer(buffer) { \
|
#define growBuffer(buffer) { \
|
||||||
buffer##_size *= 2; \
|
buffer##_size *= 2; \
|
||||||
buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
||||||
if (buffer == NULL) { \
|
if (buffer == NULL) { \
|
||||||
perror("realloc failed"); \
|
xmlGenericError(xmlGenericErrorContext, "realloc failed\n"); \
|
||||||
return(NULL); \
|
return(NULL); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -1617,79 +1617,6 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, int len ATTRIBUTE_UN
|
|||||||
deprecated = 1;
|
deprecated = 1;
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
#if 0
|
|
||||||
xmlChar *name = NULL;
|
|
||||||
xmlChar *buffer = NULL;
|
|
||||||
unsigned int buffer_size = 0;
|
|
||||||
unsigned int nbchars = 0;
|
|
||||||
htmlEntityDescPtr ent;
|
|
||||||
unsigned int max = (unsigned int) len;
|
|
||||||
int c,l;
|
|
||||||
|
|
||||||
if (ctxt->depth > 40) {
|
|
||||||
ctxt->errNo = XML_ERR_ENTITY_LOOP;
|
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Detected entity reference loop\n");
|
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
ctxt->disableSAX = 1;
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* allocate a translation buffer.
|
|
||||||
*/
|
|
||||||
buffer_size = HTML_PARSER_BIG_BUFFER_SIZE;
|
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
|
||||||
if (buffer == NULL) {
|
|
||||||
perror("xmlDecodeEntities: malloc failed");
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ok loop until we reach one of the ending char or a size limit.
|
|
||||||
*/
|
|
||||||
c = CUR_CHAR(l);
|
|
||||||
while ((nbchars < max) && (c != end) &&
|
|
||||||
(c != end2) && (c != end3)) {
|
|
||||||
|
|
||||||
if (c == 0) break;
|
|
||||||
if (((c == '&') && (ctxt->token != '&')) && (NXT(1) == '#')) {
|
|
||||||
int val = htmlParseCharRef(ctxt);
|
|
||||||
COPY_BUF(0,buffer,nbchars,val);
|
|
||||||
NEXTL(l);
|
|
||||||
} else if ((c == '&') && (ctxt->token != '&')) {
|
|
||||||
ent = htmlParseEntityRef(ctxt, &name);
|
|
||||||
if (name != NULL) {
|
|
||||||
if (ent != NULL) {
|
|
||||||
int val = ent->value;
|
|
||||||
COPY_BUF(0,buffer,nbchars,val);
|
|
||||||
NEXTL(l);
|
|
||||||
} else {
|
|
||||||
const xmlChar *cur = name;
|
|
||||||
|
|
||||||
buffer[nbchars++] = '&';
|
|
||||||
if (nbchars > buffer_size - HTML_PARSER_BUFFER_SIZE) {
|
|
||||||
growBuffer(buffer);
|
|
||||||
}
|
|
||||||
while (*cur != 0) {
|
|
||||||
buffer[nbchars++] = *cur++;
|
|
||||||
}
|
|
||||||
buffer[nbchars++] = ';';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
COPY_BUF(l,buffer,nbchars,c);
|
|
||||||
NEXTL(l);
|
|
||||||
if (nbchars > buffer_size - HTML_PARSER_BUFFER_SIZE) {
|
|
||||||
growBuffer(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c = CUR_CHAR(l);
|
|
||||||
}
|
|
||||||
buffer[nbchars++] = 0;
|
|
||||||
return(buffer);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -1989,7 +1916,8 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
|
|||||||
buffer_size = HTML_PARSER_BUFFER_SIZE;
|
buffer_size = HTML_PARSER_BUFFER_SIZE;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("htmlParseHTMLAttribute: malloc failed");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"htmlParseHTMLAttribute: malloc failed\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
out = buffer;
|
out = buffer;
|
||||||
@ -3830,7 +3758,6 @@ htmlNewParserCtxt(void)
|
|||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"xmlNewParserCtxt : cannot allocate context\n");
|
"xmlNewParserCtxt : cannot allocate context\n");
|
||||||
perror("malloc");
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ctxt, 0, sizeof(xmlParserCtxt));
|
memset(ctxt, 0, sizeof(xmlParserCtxt));
|
||||||
@ -4941,14 +4868,14 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
|
|||||||
|
|
||||||
ctxt = (htmlParserCtxtPtr) xmlMalloc(sizeof(htmlParserCtxt));
|
ctxt = (htmlParserCtxtPtr) xmlMalloc(sizeof(htmlParserCtxt));
|
||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ctxt, 0, sizeof(htmlParserCtxt));
|
memset(ctxt, 0, sizeof(htmlParserCtxt));
|
||||||
htmlInitParserCtxt(ctxt);
|
htmlInitParserCtxt(ctxt);
|
||||||
inputStream = (htmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput));
|
inputStream = (htmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput));
|
||||||
if (inputStream == NULL) {
|
if (inputStream == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
|
||||||
xmlFree(ctxt);
|
xmlFree(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
4
c14n.c
4
c14n.c
@ -1821,7 +1821,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
|
|||||||
buffer = (xmlChar *) \
|
buffer = (xmlChar *) \
|
||||||
xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
|
xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
|
||||||
if (buffer == NULL) { \
|
if (buffer == NULL) { \
|
||||||
perror("realloc failed"); \
|
xmlGenericError(xmlGenericErrorContext, "realloc failed"); \
|
||||||
return(NULL); \
|
return(NULL); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -1856,7 +1856,7 @@ xmlC11NNormalizeString(const xmlChar * input,
|
|||||||
buffer_size = 1000;
|
buffer_size = 1000;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("malloc failed");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
out = buffer;
|
out = buffer;
|
||||||
|
16
entities.c
16
entities.c
@ -419,9 +419,10 @@ static xmlChar *static_buffer = NULL;
|
|||||||
|
|
||||||
static int growBuffer(void) {
|
static int growBuffer(void) {
|
||||||
static_buffer_size *= 2;
|
static_buffer_size *= 2;
|
||||||
static_buffer = (xmlChar *) xmlRealloc(static_buffer, static_buffer_size * sizeof(xmlChar));
|
static_buffer = (xmlChar *) xmlRealloc(static_buffer,
|
||||||
|
static_buffer_size * sizeof(xmlChar));
|
||||||
if (static_buffer == NULL) {
|
if (static_buffer == NULL) {
|
||||||
perror("realloc failed");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
@ -466,9 +467,10 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
|
|||||||
|
|
||||||
if (static_buffer == NULL) {
|
if (static_buffer == NULL) {
|
||||||
static_buffer_size = 1000;
|
static_buffer_size = 1000;
|
||||||
static_buffer = (xmlChar *) xmlMalloc(static_buffer_size * sizeof(xmlChar));
|
static_buffer = (xmlChar *)
|
||||||
|
xmlMalloc(static_buffer_size * sizeof(xmlChar));
|
||||||
if (static_buffer == NULL) {
|
if (static_buffer == NULL) {
|
||||||
perror("malloc failed");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
out = static_buffer;
|
out = static_buffer;
|
||||||
@ -561,7 +563,7 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
|
|||||||
buffer = (xmlChar *) \
|
buffer = (xmlChar *) \
|
||||||
xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
|
xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
|
||||||
if (buffer == NULL) { \
|
if (buffer == NULL) { \
|
||||||
perror("realloc failed"); \
|
xmlGenericError(xmlGenericErrorContext, "realloc failed\n"); \
|
||||||
return(NULL); \
|
return(NULL); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -597,7 +599,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
|
|||||||
buffer_size = 1000;
|
buffer_size = 1000;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("malloc failed");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
out = buffer;
|
out = buffer;
|
||||||
@ -780,7 +782,7 @@ xmlEncodeSpecialChars(xmlDocPtr doc, const xmlChar *input) {
|
|||||||
buffer_size = 1000;
|
buffer_size = 1000;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("malloc failed");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
out = buffer;
|
out = buffer;
|
||||||
|
18
list.c
18
list.c
@ -181,7 +181,8 @@ xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare)
|
|||||||
{
|
{
|
||||||
xmlListPtr l;
|
xmlListPtr l;
|
||||||
if (NULL == (l = (xmlListPtr )xmlMalloc( sizeof(xmlList)))) {
|
if (NULL == (l = (xmlListPtr )xmlMalloc( sizeof(xmlList)))) {
|
||||||
perror("Cannot initialize memory for list");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Cannot initialize memory for list");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
/* Initialize the list to NULL */
|
/* Initialize the list to NULL */
|
||||||
@ -189,7 +190,8 @@ xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare)
|
|||||||
|
|
||||||
/* Add the sentinel */
|
/* Add the sentinel */
|
||||||
if (NULL ==(l->sentinel = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) {
|
if (NULL ==(l->sentinel = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) {
|
||||||
perror("Cannot initialize memory for sentinel");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Cannot initialize memory for sentinel");
|
||||||
xmlFree(l);
|
xmlFree(l);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -264,7 +266,8 @@ xmlListInsert(xmlListPtr l, void *data)
|
|||||||
/* Add the new link */
|
/* Add the new link */
|
||||||
lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
|
lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
|
||||||
if (lkNew == NULL) {
|
if (lkNew == NULL) {
|
||||||
perror("Cannot initialize memory for new link");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Cannot initialize memory for new link");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
lkNew->data = data;
|
lkNew->data = data;
|
||||||
@ -293,7 +296,8 @@ int xmlListAppend(xmlListPtr l, void *data)
|
|||||||
/* Add the new link */
|
/* Add the new link */
|
||||||
lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
|
lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
|
||||||
if (lkNew == NULL) {
|
if (lkNew == NULL) {
|
||||||
perror("Cannot initialize memory for new link");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Cannot initialize memory for new link");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
lkNew->data = data;
|
lkNew->data = data;
|
||||||
@ -507,7 +511,8 @@ xmlListPushFront(xmlListPtr l, void *data)
|
|||||||
/* Add the new link */
|
/* Add the new link */
|
||||||
lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
|
lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink));
|
||||||
if (lkNew == NULL) {
|
if (lkNew == NULL) {
|
||||||
perror("Cannot initialize memory for new link");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Cannot initialize memory for new link");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
lkNew->data = data;
|
lkNew->data = data;
|
||||||
@ -535,7 +540,8 @@ xmlListPushBack(xmlListPtr l, void *data)
|
|||||||
lkPlace = l->sentinel->prev;
|
lkPlace = l->sentinel->prev;
|
||||||
/* Add the new link */
|
/* Add the new link */
|
||||||
if (NULL ==(lkNew = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) {
|
if (NULL ==(lkNew = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) {
|
||||||
perror("Cannot initialize memory for new link");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Cannot initialize memory for new link");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
lkNew->data = data;
|
lkNew->data = data;
|
||||||
|
11
parser.c
11
parser.c
@ -931,7 +931,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
|
|||||||
buffer = (xmlChar *) \
|
buffer = (xmlChar *) \
|
||||||
xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
||||||
if (buffer == NULL) { \
|
if (buffer == NULL) { \
|
||||||
perror("realloc failed"); \
|
xmlGenericError(xmlGenericErrorContext, "realloc failed"); \
|
||||||
return(NULL); \
|
return(NULL); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -984,7 +984,8 @@ xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what,
|
|||||||
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
|
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("xmlStringDecodeEntities: malloc failed");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlStringDecodeEntities: malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2341,7 +2342,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt) {
|
|||||||
buf_size = XML_PARSER_BUFFER_SIZE;
|
buf_size = XML_PARSER_BUFFER_SIZE;
|
||||||
buf = (xmlChar *) xmlMalloc(buf_size * sizeof(xmlChar));
|
buf = (xmlChar *) xmlMalloc(buf_size * sizeof(xmlChar));
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
perror("xmlParseAttValue: malloc failed");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlParseAttValue: malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10191,7 +10193,8 @@ xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer,
|
|||||||
|
|
||||||
input = xmlNewInputStream(ctxt);
|
input = xmlNewInputStream(ctxt);
|
||||||
if (input == NULL) {
|
if (input == NULL) {
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"malloc");
|
||||||
xmlFree(ctxt);
|
xmlFree(ctxt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2351,7 +2351,7 @@ xmlNewParserCtxt()
|
|||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"xmlNewParserCtxt : cannot allocate context\n");
|
"xmlNewParserCtxt : cannot allocate context\n");
|
||||||
perror("malloc");
|
xmlGenericError(xmlGenericErrorContext, "malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ctxt, 0, sizeof(xmlParserCtxt));
|
memset(ctxt, 0, sizeof(xmlParserCtxt));
|
||||||
@ -2767,7 +2767,8 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUS
|
|||||||
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
|
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
|
||||||
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
perror("xmlDecodeEntities: malloc failed");
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlDecodeEntities: malloc failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user