* [patch]: Fix memory leak of symtab.c
@ 2008-07-08 6:57 teawater
2008-07-09 17:15 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: teawater @ 2008-07-08 6:57 UTC (permalink / raw)
To: gdb-patches
symtab.c has a memory leek in function expand_line_sal. struct block
**blocks and int *filter are xmalloc at line 4459 and 4460. There are
returns at the end of this function without calling xfree. And these
variables is just used in this function. So I change them to "alloca".
This patch is for the GDB cvs version.
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;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch]: Fix memory leak of symtab.c
2008-07-08 6:57 [patch]: Fix memory leak of symtab.c teawater
@ 2008-07-09 17:15 ` Joel Brobecker
2008-07-10 3:07 ` teawater
0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2008-07-09 17:15 UTC (permalink / raw)
To: teawater; +Cc: gdb-patches
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch]: Fix memory leak of symtab.c
2008-07-09 17:15 ` Joel Brobecker
@ 2008-07-10 3:07 ` teawater
2008-07-13 17:03 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: teawater @ 2008-07-10 3:07 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch]: Fix memory leak of symtab.c
2008-07-10 3:07 ` teawater
@ 2008-07-13 17:03 ` Joel Brobecker
2008-07-14 5:58 ` teawater
0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2008-07-13 17:03 UTC (permalink / raw)
To: teawater; +Cc: gdb-patches
> 2008-06-21 Hui Zhu <teawater@gmail.com>
>
> * symtab.c (expand_line_sal): Fix a memory leak.
Michael told me that you don't have write access. So I checked you
patch in for you. Are there other patches that we approved and didn't
get checked in?
As I told Michael, you qualify for write-after-approval priviledges
(this would allow you to commit the changes yourself after they are
approved). Let me know if you're interested.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch]: Fix memory leak of symtab.c
2008-07-13 17:03 ` Joel Brobecker
@ 2008-07-14 5:58 ` teawater
0 siblings, 0 replies; 5+ messages in thread
From: teawater @ 2008-07-14 5:58 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Hi Joel,
> Michael told me that you don't have write access. So I checked you
> patch in for you. Are there other patches that we approved and didn't
> get checked in?
I don't have other patches need to check-in. Thanks for your help.
>
> As I told Michael, you qualify for write-after-approval priviledges
> (this would allow you to commit the changes yourself after they are
> approved). Let me know if you're interested.
Great! It's my pleasure. Thanks you very much. :)
Hui
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-14 5:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-08 6:57 [patch]: Fix memory leak of symtab.c teawater
2008-07-09 17:15 ` Joel Brobecker
2008-07-10 3:07 ` teawater
2008-07-13 17:03 ` Joel Brobecker
2008-07-14 5:58 ` teawater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox