From ad6f55d92fe8c5fcef18290e7a4d635e23152108 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 8 Apr 2015 18:37:12 -0400 Subject: [PATCH] dbStatic: always clear parser tempList Warn if tempList is not empty when it should be --- src/ioc/dbStatic/dbLexRoutines.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ioc/dbStatic/dbLexRoutines.c b/src/ioc/dbStatic/dbLexRoutines.c index e224aa81a..c77f82313 100644 --- a/src/ioc/dbStatic/dbLexRoutines.c +++ b/src/ioc/dbStatic/dbLexRoutines.c @@ -200,6 +200,10 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, char *penv; char **macPairs; + if(ellCount(&tempList)) { + epicsPrintf("dbReadCOM: Parser stack dirty %d\n", ellCount(&tempList)); + } + if(*ppdbbase == 0) *ppdbbase = dbAllocBase(); pdbbase = *ppdbbase; if(path && strlen(path)>0) { @@ -257,9 +261,10 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, ellAdd(&inputFileList,&pinputFile->node); status = pvt_yy_parse(); - if (yyAbort) - while (ellCount(&tempList)) - popFirstTemp(); // Memory leak on parser failure + if (ellCount(&tempList) && !yyAbort) + epicsPrintf("dbReadCOM: Parser stack dirty w/o error. %d\n", ellCount(&tempList)); + while (ellCount(&tempList)) + popFirstTemp(); /* Memory leak on parser failure */ dbFreePath(pdbbase); if(!status) { /*add RTYP and VERS as an attribute */