diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-04-13 15:55:38 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-04-13 15:55:38 +0200 |
commit | 57722664bcdfcd7be425ad3db02a884ff8c17f47 (patch) | |
tree | d51e4c4f660360fb628775043b6e72d1894a90e2 /runtime | |
parent | 32974b890401a8b6b44890b150c1ea205ff029a0 (diff) | |
download | rsyslog-57722664bcdfcd7be425ad3db02a884ff8c17f47.tar.gz rsyslog-57722664bcdfcd7be425ad3db02a884ff8c17f47.tar.xz rsyslog-57722664bcdfcd7be425ad3db02a884ff8c17f47.zip |
bugfix (kind of): memory leak with tcp reception epoll handler
This was an extremely unlikely leak and, if it happend, quite small.
Still it is better to handle this border case.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/nsdpoll_ptcp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/runtime/nsdpoll_ptcp.c b/runtime/nsdpoll_ptcp.c index 78203292..8c90d7fd 100644 --- a/runtime/nsdpoll_ptcp.c +++ b/runtime/nsdpoll_ptcp.c @@ -159,9 +159,19 @@ ENDobjConstruct(nsdpoll_ptcp) /* destructor for the nsdpoll_ptcp object */ BEGINobjDestruct(nsdpoll_ptcp) /* be sure to specify the object type also in END and CODESTART macros! */ + nsdpoll_epollevt_lst_t *node; + nsdpoll_epollevt_lst_t *nextnode; CODESTARTobjDestruct(nsdpoll_ptcp) - //printf("ndspoll_ptcp destruct, event list root is %p\n", pThis->pRoot); -#warning cleanup event list is missing! (at least I think so) + /* we check if the epoll list still holds entries. This may happen, but + * is a bit unusual. + */ + if(pThis->pRoot != NULL) { + for(node = pThis->pRoot ; node != NULL ; node = nextnode) { + nextnode = node->pNext; + dbgprintf("nsdpoll_ptcp destruct, need to destruct node %p\n", node); + delEvent(&node); + } + } pthread_mutex_destroy(&pThis->mutEvtLst); ENDobjDestruct(nsdpoll_ptcp) |