blob: a8b9db897ed6aded04f87c36d573ca9a4a490d8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
From: Daniel Veillard <veillard@redhat.com>
Date: Thu, 11 Jul 2013 15:41:22 +0800
Subject: Catch malloc error and exit accordingly
As pointed privately by Bill Parker <wp02855@gmail.com>
---
xmllint.c | 4 ++++
1 file changed, 4 insertions(+)
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++;
}
|