In report_r_debug we don't fully handle an out of memory condition
when trying to allocate memory for the r_debug_info_module struct.
Deallocated allocated buffers and return -1 immediately instead of
trying to continue.
* libdwfl/link_map.c (report_r_debug): Call release_buffer
with -1 and return on malloc failure.
Signed-off-by: Mark Wielaard <mark@klomp.org>
r_debug_info_module = malloc (sizeof (*r_debug_info_module)
+ strlen (name1) + 1);
if (unlikely (r_debug_info_module == NULL))
- release_buffer (&memory_closure, &buffer,
- &buffer_available, result);
+ return release_buffer (&memory_closure, &buffer,
+ &buffer_available, -1);
r_debug_info_module->fd = -1;
r_debug_info_module->elf = NULL;
r_debug_info_module->l_ld = l_ld;