Skip to content

Commit

Permalink
fix vector resize crash
Browse files Browse the repository at this point in the history
  • Loading branch information
microcai committed Dec 25, 2024
1 parent 1a48c41 commit dab1a2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iocp4linux/src/iocp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ IOCP_DECL BOOL WINAPI GetQueuedCompletionStatusEx(
WSASetLastError(WSA_WAIT_TIMEOUT);
return false;
}
batch_cqe.resize(io_uring_ret);
}
else
{
Expand All @@ -252,7 +251,6 @@ IOCP_DECL BOOL WINAPI GetQueuedCompletionStatusEx(
io_uring_ret = io_uring_peek_batch_cqe(&iocp->ring_, batch_cqe.data(), batch_cqe.size());
}
}
batch_cqe.resize(io_uring_ret);
}

if (io_uring_ret < 0) [[unlikely]]
Expand All @@ -275,6 +273,8 @@ IOCP_DECL BOOL WINAPI GetQueuedCompletionStatusEx(
return false;
}

batch_cqe.resize(io_uring_ret);

if (io_uring_cq_has_overflow(&(iocp->ring_))) [[unlikely]]
{
std::cerr << "uring completion queue overflow!" << std::endl;
Expand Down

0 comments on commit dab1a2b

Please sign in to comment.