[libxml2] Catch malloc error and exit accordingly
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Catch malloc error and exit accordingly
- Date: Thu, 11 Jul 2013 07:43:20 +0000 (UTC)
commit e71dce18a1a72578581d4e91c24a44eead0d5949
Author: Daniel Veillard <veillard redhat com>
Date: Thu Jul 11 15:41:22 2013 +0800
Catch malloc error and exit accordingly
As pointed privately by Bill Parker <wp02855 gmail com>
xmllint.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/xmllint.c b/xmllint.c
index c0196ab..4d464e4 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -3090,6 +3090,10 @@ static void usage(const char *name) {
static void registerNode(xmlNodePtr node)
{
node->_private = malloc(sizeof(long));
+ if (node->_private == NULL) {
+ fprintf(stderr, "Out of memory in xmllint:registerNode()\n");
+ exit(XMLLINT_ERR_MEM);
+ }
*(long*)node->_private = (long) 0x81726354;
nbregister++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]