Check error pointer

This commit is contained in:
Stefan Ritt 2012-02-03 15:50:14 +00:00
parent 9fe5b85a7f
commit d8cffaed40

2
mxml.c
View File

@ -1274,12 +1274,14 @@ PMXML_NODE read_error(PMXML_NODE root, const char *file_name, int line_number, c
else else
sprintf(str, "XML read error, line %d: ", line_number); sprintf(str, "XML read error, line %d: ", line_number);
msg = (char *)mxml_malloc(error_size); msg = (char *)mxml_malloc(error_size);
if (error)
strlcpy(error, str, error_size); strlcpy(error, str, error_size);
va_start(argptr, format); va_start(argptr, format);
vsprintf(str, (char *) format, argptr); vsprintf(str, (char *) format, argptr);
va_end(argptr); va_end(argptr);
if (error)
strlcat(error, str, error_size); strlcat(error, str, error_size);
if (error_line) if (error_line)
*error_line = line_number; *error_line = line_number;