This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/record-full: Use xmalloc instead of alloca for large buffers.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: Marcin KoÅcielnicki <koriakin at 0x04 dot net>, gdb-patches at sourceware dot org
- Date: Tue, 3 Nov 2015 09:36:50 -0800
- Subject: Re: [PATCH] gdb/record-full: Use xmalloc instead of alloca for large buffers.
- Authentication-results: sourceware.org; auth=none
- References: <1446489704-3173-1-git-send-email-koriakin at 0x04 dot net> <20151103173055 dot 424DAF82F at oc7340732750 dot ibm dot com>
> > gdb/ChangeLog:
> >
> > * 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 ...
Also, why not just call xmalloc every time instead of doing
a combination of alloca and xmalloc? I don't see enough benefits
to justify the extra complication.
--
Joel