diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-03 09:46:52 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-03 09:46:52 +0200 |
commit | a4318f941a8e7a6ff2816a1f9df87f35f65af4a6 (patch) | |
tree | 61a0d8cf0fa650760c7262ec6973471536dedd53 /runtime/stream.c | |
parent | 466e0264015ba5ed100c120365c31a250105c0bb (diff) | |
parent | 678a904620222b9113db8b5f89e988a064b05cd9 (diff) | |
download | rsyslog-a4318f941a8e7a6ff2816a1f9df87f35f65af4a6.tar.gz rsyslog-a4318f941a8e7a6ff2816a1f9df87f35f65af4a6.tar.xz rsyslog-a4318f941a8e7a6ff2816a1f9df87f35f65af4a6.zip |
Merge branch 'v4-stable' into v5-stable
Diffstat (limited to 'runtime/stream.c')
-rw-r--r-- | runtime/stream.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/stream.c b/runtime/stream.c index 24dbcc09..ae716815 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -259,6 +259,7 @@ static rsRetVal strmOpenFile(strm_t *pThis) if(pThis->fd != -1) ABORT_FINALIZE(RS_RET_OK); + pThis->pszCurrFName = NULL; /* used to prevent mem leak in case of error */ if(pThis->pszFName == NULL) ABORT_FINALIZE(RS_RET_FILE_PREFIX_MISSING); @@ -290,6 +291,16 @@ static rsRetVal strmOpenFile(strm_t *pThis) (pThis->tOperationsMode == STREAMMODE_READ) ? "READ" : "WRITE", pThis->fd); finalize_it: + if(iRet != RS_RET_OK) { + if(pThis->pszCurrFName != NULL) { + free(pThis->pszCurrFName); + pThis->pszCurrFName = NULL; /* just to prevent mis-adressing down the road... */ + } + if(pThis->fd != -1) { + close(pThis->fd); + pThis->fd = -1; + } + } RETiRet; } |