mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
evbuffer_add_file: munmap() correct size on mmap() failure
This commit is contained in:
parent
226b927813
commit
765c35d4a8
4
buffer.c
4
buffer.c
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user