This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] gdb/record-full: Use xmalloc instead of alloca for large buffers.
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: koriakin at 0x04 dot net (Marcin KoÅcielnicki)
- Cc: gdb-patches at sourceware dot org, koriakin at 0x04 dot net (Marcin KoÅcielnicki)
- Date: Tue, 3 Nov 2015 18:30:55 +0100 (CET)
- Subject: Re: [PATCH] gdb/record-full: Use xmalloc instead of alloca for large buffers.
- Authentication-results: sourceware.org; auth=none
Marcin KoÃ?cielnicki <koriakin at 0x04 dot net> wrote:
> On the newly added s390 target, it's possible for a single instruction
> to write practically unbounded amount of memory (eg. MVCLE). This caused
> a stack overflow when alloca was used.
> * record-full.c (record_full_exec_insn): Use xmalloc for large buffers.
I think this may leak memory if some code between the xmalloc and the xfree
throws a GDB exception. Usually, this is protected against by calling the
xfree via the make_cleanup mechanism ...
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain