evbuffer_add_file: munmap() correct size on mmap() failure

This commit is contained in:
Azat Khuzhin 2017-12-18 01:34:46 +03:00
parent 226b927813
commit 765c35d4a8

View File

@ -2846,13 +2846,13 @@ evbuffer_add_file(struct evbuffer *outbuf, int fd,
*/
if (mapped == MAP_FAILED) {
event_warn("%s: mmap(%d, %d, %zu) failed",
__func__, fd, 0, (size_t)(offset + length));
__func__, fd, 0, (size_t)(length + offset));
return (-1);
}
chain = evbuffer_chain_new(sizeof(struct evbuffer_chain_fd));
if (chain == NULL) {
event_warn("%s: out of memory", __func__);
munmap(mapped, length);
munmap(mapped, length + offset);
return (-1);
}