mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
Merge pull request #3255 from tchaikov/async-leak
AsyncMessenger: fix the leak of file_events
This commit is contained in:
commit
3f83e88008
@ -92,9 +92,10 @@ int EventCenter::init(int n)
|
||||
|
||||
EventCenter::~EventCenter()
|
||||
{
|
||||
if (driver)
|
||||
delete driver;
|
||||
delete driver;
|
||||
|
||||
if (file_events)
|
||||
free(file_events);
|
||||
if (notify_receive_fd > 0)
|
||||
::close(notify_receive_fd);
|
||||
if (notify_send_fd > 0)
|
||||
@ -119,6 +120,7 @@ int EventCenter::create_file_event(int fd, int mask, EventCallbackRef ctxt)
|
||||
lderr(cct) << __func__ << " failed to realloc file_events" << cpp_strerror(errno) << dendl;
|
||||
return -errno;
|
||||
}
|
||||
memset(file_events+sizeof(FileEvent)*nevent, 0, sizeof(FileEvent)*(new_size-nevent));
|
||||
file_events = new_events;
|
||||
nevent = new_size;
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ class EventCenter {
|
||||
EventCenter(CephContext *c):
|
||||
cct(c), nevent(0),
|
||||
lock("AsyncMessenger::lock"),
|
||||
file_events(NULL),
|
||||
driver(NULL), time_event_next_id(0),
|
||||
notify_receive_fd(-1), notify_send_fd(-1), net(c), owner(0) {
|
||||
last_time = time(NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user