blob: c90b089854ca995c2b045d85cff25cffeb166acf (
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
25
26
|
$NetBSD: patch-ae,v 1.1 2004/01/21 16:26:37 cube Exp $
--- src/xmlparse.c.orig 2003-11-03 22:05:18.000000000 +0100
+++ src/xmlparse.c
@@ -51,7 +51,7 @@
#include "xmlparse.h"
#define malloc g_malloc
-#define calloc(n,s) g_malloc0(n * s)
+#define calloc(n,s) g_malloc0((n) * (s))
#define TAGSTACK_INCR 20
@@ -162,10 +162,11 @@ static void startElementH(struct parser_
e->attrs = NULL;
if (attrs) {
for (i = 0 ; attrs[i] ; i++) ;
- e->attrs = calloc(i, sizeof(xmlChar *));
+ e->attrs = calloc(i+1, sizeof(xmlChar *));
for (i = 0 ; attrs[i] ; i++) {
e->attrs[i] = strdup(attrs[i]);
}
+ e->attrs[i] = NULL;
}
/* lookup handler */
|