AsyncMessenger: reset newly allocated file_events

* otherwise there is chance that Event could take them as already
  initialized ones even they are filled with random bits from heap.
This commit is contained in:
Kefu Chai 2014-12-26 16:28:22 +08:00
parent e4e1777894
commit 25cf82e2c8

View File

@ -120,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;
}