]> granicus.if.org Git - libexpat/commitdiff
Keep allocDefaultAtts consistent if allocating defaultAtts fails.
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 2 Aug 2017 16:35:25 +0000 (17:35 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Tue, 22 Aug 2017 22:20:28 +0000 (00:20 +0200)
See issue #8

expat/lib/xmlparse.c

index 0df68830f05e3a9c6e5f2e97af2d5ec6681a6e6f..d247b1fea92f24fbfcc93c3c4dac358c4d69a003 100644 (file)
@@ -6052,8 +6052,10 @@ defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata,
       type->allocDefaultAtts = 8;
       type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts
                             * sizeof(DEFAULT_ATTRIBUTE));
-      if (!type->defaultAtts)
+      if (!type->defaultAtts) {
+        type->allocDefaultAtts = 0;
         return 0;
+      }
     }
     else {
       DEFAULT_ATTRIBUTE *temp;