Never call unmap with MAP_FAILED. (#5590)
authorTobias Stoeckmann <stoeckmann@users.noreply.github.com>
Tue, 14 Mar 2017 21:33:22 +0000 (22:33 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 14 Mar 2017 21:33:22 +0000 (17:33 -0400)
commitff8017c4a29c80a8260d658194e2ae41674906c5
tree5f0f37fa674017dd49117bc0103ad365ed2fec1c
parent6f94e420e8355421fc31713a0df760d6b20473ac
Never call unmap with MAP_FAILED. (#5590)

When mmap is called, the code in correctly checks for p == MAP_FAILED.

But the resource cleanup at the end of busname_peek_message checks for
p == NULL, and if that's not true, munmap is called.

Therefore in error case, munmap is called with a MAP_FAILED argument
which can result in unexpected behaviour depending on sz's value.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
src/core/busname.c