From 0abf000fa4f1ccf0392b8c3287149515a4dcf13b Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Tue, 22 Aug 2017 11:54:52 +0100 Subject: [PATCH] Plug memory leak in xmlwf's end of doctype declaration handler --- expat/xmlwf/xmlwf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c index d738f75a..9663f55d 100644 --- a/expat/xmlwf/xmlwf.c +++ b/expat/xmlwf/xmlwf.c @@ -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) { -- 2.40.0