diff options
author | Michael Biebl <biebl@debian.org> | 2011-05-19 22:53:09 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2011-05-19 22:53:09 +0200 |
commit | 734f0031f3366c83552de8b0e628949d47ff9487 (patch) | |
tree | 75cb2c0985c21bc7ffd6d06e94ec7fb420f2a1c4 /runtime/stream.c | |
parent | 2e96de39e5394008f97d6c194e507e629d836738 (diff) | |
download | rsyslog-734f0031f3366c83552de8b0e628949d47ff9487.tar.gz |
Imported Upstream version 5.8.1upstream/5.8.1
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 24dbcc0..ae71681 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; } |