mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-10 19:23:41 +01:00
Fix file descriptor leakage in maps_init
If mmap fails, be sure to close the maps file before returning an error. Signed-off-by: Zachary T Welch <zwelch@codesourcery.com> Signed-off-by: Ken Werner <ken.werner@linaro.org>
This commit is contained in:
parent
13cd3b0c26
commit
6a072982dd
1 changed files with 5 additions and 1 deletions
|
@ -80,7 +80,11 @@ maps_init (struct map_iterator *mi, pid_t pid)
|
|||
cp = mmap (0, mi->buf_size, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (cp == MAP_FAILED)
|
||||
{
|
||||
close(mi->fd);
|
||||
mi->fd = -1;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mi->offset = 0;
|
||||
|
|
Loading…
Reference in a new issue