mirror of
https://github.com/ceph/ceph
synced 2025-01-20 18:21:57 +00:00
msg/async/EventKqueue: assert on OOM
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
c643ffd703
commit
d64f0ec7b8
@ -198,15 +198,14 @@ int KqueueDriver::resize_events(int newsize)
|
||||
{
|
||||
ldout(cct,30) << __func__ << " kqfd = " << kqfd << "newsize = " << newsize
|
||||
<< dendl;
|
||||
if(newsize > sav_max) {
|
||||
void *_realloc = NULL;
|
||||
if ((_realloc = realloc(sav_events, sizeof(struct SaveEvent)*newsize)) == NULL) {
|
||||
if (newsize > sav_max) {
|
||||
sav_events = realloc(sav_events, sizeof(struct SaveEvent)*newsize);
|
||||
if (!sav_events) {
|
||||
lderr(cct) << __func__ << " unable to realloc memory: "
|
||||
<< cpp_strerror(errno) << dendl;
|
||||
free(sav_events);
|
||||
assert(sav_events);
|
||||
return -ENOMEM;
|
||||
}
|
||||
sav_events = (struct SaveEvent*)_realloc;
|
||||
memset(&sav_events[size], 0, sizeof(struct SaveEvent)*(newsize-sav_max));
|
||||
sav_max = newsize;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user