]> granicus.if.org Git - libexpat/commitdiff
Plug memory leak in xmlwf's end of doctype declaration handler
authorRhodri James <rhodri@kynesim.co.uk>
Tue, 22 Aug 2017 10:54:52 +0000 (11:54 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Tue, 22 Aug 2017 21:14:55 +0000 (23:14 +0200)
expat/xmlwf/xmlwf.c

index d738f75a202afa307d4080b4ffed8321f62fda6a..9663f55d17ac1be3be772ac12ec192fe2f16619a 100644 (file)
@@ -369,8 +369,12 @@ endDoctypeDecl(void *userData)
   /* How many notations do we have? */
   for (p = data->notationListHead; p != NULL; p = p->next)
     notationCount++;
-  if (notationCount == 0)
-    return; /* Nothing to report */
+  if (notationCount == 0) {
+    /* Nothing to report */
+    free((void *)data->currentDoctypeName);
+    data->currentDoctypeName = NULL;
+    return;
+  }
 
   notations = malloc(notationCount * sizeof(NotationList *));
   if (notations == NULL) {