mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-03 04:12:10 +08:00
mmap: Fix a memory leak in _bfd_mmap_read_temporary
Return malloced memory in *mmap_base so that _bfd_munmap_readonly_temporary will free it. * libbfd.c (_bfd_mmap_read_temporary): Return malloced memory in *mmap_base.
This commit is contained in:
parent
c3460201a6
commit
533da9536e
@ -1223,7 +1223,11 @@ _bfd_mmap_read_temporary (void **data_p, size_t *size_p,
|
||||
if (data == NULL)
|
||||
return false;
|
||||
*data_p = data;
|
||||
/* NB: _bfd_munmap_readonly_temporary will free *MMAP_BASE if
|
||||
*SIZE_P == 0. */
|
||||
*mmap_base = data;
|
||||
}
|
||||
else
|
||||
*mmap_base = NULL;
|
||||
*size_p = 0;
|
||||
return bfd_read (data, size, abfd) == size;
|
||||
|
Loading…
Reference in New Issue
Block a user