mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-17 14:00:41 +01:00
bugfix: memory and file descriptor leak in stream processing
Leaks could occur under some circumstances if the file stream handler errored out during the open call. Among others, this could cause very big memory leaks if there were a problem with unreadable disk queue files. In regard to the memory leak, this closes: http://bugzilla.adiscon.com/show_bug.cgi?id=256
This commit is contained in:
parent
921bebc8ee
commit
678a904620
@ -3,6 +3,12 @@ Version 4.6.6 [v4-stable] (rgerhards), 2010-11-??
|
||||
- bugfix: IPv6-address could not be specified in omrelp
|
||||
this was due to improper parsing of ":"
|
||||
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=250
|
||||
- bugfix: memory and file descriptor leak in stream processing
|
||||
Leaks could occur under some circumstances if the file stream handler
|
||||
errored out during the open call. Among others, this could cause very
|
||||
big memory leaks if there were a problem with unreadable disk queue
|
||||
files. In regard to the memory leak, this
|
||||
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=256
|
||||
- bugfix: imfile potentially duplicates lines
|
||||
This can happen when 0 bytes are read from the input file, and some
|
||||
writer appends data to the file BEFORE we check if a rollover happens.
|
||||
|
||||
@ -258,6 +258,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);
|
||||
@ -289,6 +290,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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user