From 2b18840a0b7fde7f664d64f5d296be5fc667389b Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Wed, 16 Nov 2011 20:21:27 -0500 Subject: [PATCH] check return value from vasprintf --- src/xml_sax_parser.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/xml_sax_parser.cc b/src/xml_sax_parser.cc index b2f96089..3b45873b 100644 --- a/src/xml_sax_parser.cc +++ b/src/xml_sax_parser.cc @@ -455,11 +455,10 @@ SaxParserCallback::warning(void* context, va_list args; va_start(args, msg); - vasprintf(&message, msg, args); + if (vasprintf(&message, msg, args) >= 0) + parser->warning(message); va_end(args); - parser->warning(message); - free(message); } @@ -473,11 +472,10 @@ SaxParserCallback::error(void* context, va_list args; va_start(args, msg); - vasprintf(&message, msg, args); + if (vasprintf(&message, msg, args) >= 0) + parser->error(message); va_end(args); - parser->error(message); - free(message); }