+2015-12-01 Mark Wielaard <mjw@redhat.com>
+
+ * link_map.c (dwfl_link_map_report): Track whether in.d_buf comes
+ from exec or memory_callback, free as appropriate.
+
2015-12-01 Mark Wielaard <mjw@redhat.com>
* libdwflP.h (struct Dwfl_User_Core): New.
bool in_ok = (*memory_callback) (dwfl, phdr_segndx, &in.d_buf,
&in.d_size, phdr, phnum * phent,
memory_callback_arg);
+ bool in_from_exec = false;
if (! in_ok
&& dwfl->user_core != NULL
&& dwfl->user_core->executable_for_core != NULL)
return false;
}
in_ok = true;
+ in_from_exec = true;
}
if (in_ok)
{
}
}
- (*memory_callback) (dwfl, -1, &in.d_buf, &in.d_size, 0, 0,
- memory_callback_arg);
+ if (in_from_exec)
+ free (in.d_buf);
+ else
+ (*memory_callback) (dwfl, -1, &in.d_buf, &in.d_size, 0, 0,
+ memory_callback_arg);
free (buf);
}
else