Avoid realloc(NULL, n) in defineAttribute
diff --git a/expat/xmlparse/xmlparse.c b/expat/xmlparse/xmlparse.c
index 520509a..4709579 100755
--- a/expat/xmlparse/xmlparse.c
+++ b/expat/xmlparse/xmlparse.c
@@ -2146,12 +2146,15 @@
 {
   DEFAULT_ATTRIBUTE *att;
   if (type->nDefaultAtts == type->allocDefaultAtts) {
-    if (type->allocDefaultAtts == 0)
+    if (type->allocDefaultAtts == 0) {
       type->allocDefaultAtts = 8;
-    else
+      type->defaultAtts = malloc(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+    }
+    else {
       type->allocDefaultAtts *= 2;
-    type->defaultAtts = realloc(type->defaultAtts,
-				type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+      type->defaultAtts = realloc(type->defaultAtts,
+				  type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+    }
     if (!type->defaultAtts)
       return 0;
   }
@@ -2279,7 +2282,8 @@
     ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
     if (!e)
       break;
-    free(e->defaultAtts);
+    if (e->allocDefaultAtts != 0)
+      free(e->defaultAtts);
   }
   hashTableDestroy(&(p->generalEntities));
   hashTableDestroy(&(p->elementTypes));