From e99c01e58ec6f21e8be2113485fb61f19345e57d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 6 Nov 2013 14:30:04 +0100 Subject: fix previously introduced memleak with template strings --- action.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/action.c b/action.c index 6b7169ab..2941e0e6 100644 --- a/action.c +++ b/action.c @@ -1000,6 +1000,7 @@ actionFreeParams(action_t *pThis, wti_t *pWti) { actWrkrInfo_t *wrkrInfo; actWrkrIParams_t *iparamCurr, *iparamDel; + int j; wrkrInfo = &(pWti->actWrkrInfo[pThis->iActionNbr]); dbgprintf("DDDD: actionFreeParams: action %d, root %p\n", pThis->iActionNbr, wrkrInfo->iparamRoot); @@ -1009,7 +1010,15 @@ actionFreeParams(action_t *pThis, wti_t *pWti) releaseDoActionParams(pThis, pWti); iparamDel = iparamCurr; iparamCurr = iparamCurr->next; - free(iparamDel); // TODO: memleak strings! + for(j = 0 ; j < CONF_OMOD_NUMSTRINGS_MAXSIZE ; ++j) { + /* TODO: we can save time by not freeing everything, + * but that's left for a later optimization. + */ + free(iparamDel->staticActStrings[j]); + iparamDel->staticActStrings[j] = NULL; + iparamDel->staticLenStrings[j] = 0; + } + free(iparamDel); } wrkrInfo->iparamRoot = wrkrInfo->iparamLast = NULL; } -- cgit v1.2.3