--- src/xmlparse.c.orig	Mon Nov  3 22:05:18 2003
+++ src/xmlparse.c	Sat Feb  5 06:50:26 2005
@@ -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 */
