Fix two memory issues discovered by valgrind
This commit is contained in:
2
buffer.h
2
buffer.h
@@ -35,7 +35,7 @@ class Buffer : public ConstBuffer {
|
|||||||
void Consume(); // discard up to last commit
|
void Consume(); // discard up to last commit
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<char> own_buf_;
|
std::unique_ptr<char[]> own_buf_;
|
||||||
char *buf_;
|
char *buf_;
|
||||||
const size_t size_;
|
const size_t size_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,8 +49,9 @@ FastCGIServer::FastCGIServer(int port, const std::function<void(std::unique_ptr<
|
|||||||
|
|
||||||
void FastCGIServer::Serve() {
|
void FastCGIServer::Serve() {
|
||||||
while (true) {
|
while (true) {
|
||||||
struct epoll_event events[256];
|
constexpr auto max_events = 256;
|
||||||
auto num_fd = epoll_wait(epoll_fd_, events, sizeof(events), -1);
|
struct epoll_event events[max_events];
|
||||||
|
auto num_fd = epoll_wait(epoll_fd_, events, max_events, -1);
|
||||||
if (num_fd == -1 && errno == EINTR) {
|
if (num_fd == -1 && errno == EINTR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user