From: Rhodri James Date: Tue, 22 Aug 2017 10:54:52 +0000 (+0100) Subject: Plug memory leak in xmlwf's end of doctype declaration handler X-Git-Tag: R_2_2_5~39^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0abf000fa4f1ccf0392b8c3287149515a4dcf13b;p=libexpat Plug memory leak in xmlwf's end of doctype declaration handler --- 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) {