This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: Fix memory leak of symtab.c


OK. Thanks Joel.

2008-06-21  Hui Zhu  <teawater@gmail.com>

     * symtab.c (expand_line_sal): Fix a memory leak.

--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4456,8 +4456,8 @@ expand_line_sal (struct symtab_and_line
     blocks -- for each PC found above we see if there are other PCs
     that are in the same block.  If yes, the other PCs are filtered out.  */

-  filter = xmalloc (ret.nelts * sizeof (int));
-  blocks = xmalloc (ret.nelts * sizeof (struct block *));
+  filter = alloca (ret.nelts * sizeof (int));
+  blocks = alloca (ret.nelts * sizeof (struct block *));
  for (i = 0; i < ret.nelts; ++i)
    {
      filter[i] = 1;

On Thu, Jul 10, 2008 at 01:15, Joel Brobecker <brobecker@adacore.com> wrote:
>> 2008-06-21  Hui Zhu  <teawater@gmail.com>
>>       * symtab.c (expand_line_sal): Fix a memory leak.
>
> Yes, this is OK. (just make sure to have an empty line between the
> ChangeLog header and the actual contents)
>
> Thank you!
>
> --
> Joel
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]