Here we need to free pThis->pszCurrFName in any case, even if
pThis->bDeleteOnClose is not true.  Otherwise we leak memory if
this stream gets reopened later, for instance after closing by
doSizeLimitProcessing.
---
 runtime/stream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/runtime/stream.c b/runtime/stream.c
index 07dd9ca..c777cfb 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -448,13 +448,13 @@ static rsRetVal strmCloseFile(strm_t *pThis)
                        DBGPRINTF("error %d unlinking '%s' - ignored: %s\n",
                                   errno, pThis->pszCurrFName, errStr);
                }
-               free(pThis->pszCurrFName);
-               pThis->pszCurrFName = NULL;
        }
 
        pThis->iCurrOffs = 0;   /* we are back at begin of file */
 
 finalize_it:
+       free(pThis->pszCurrFName);
+       pThis->pszCurrFName = NULL;
        RETiRet;
 }
 
-- 
2.1.4
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to