From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA] elfread.c (elf_symtab_read): Stop memory leak.
Date: Tue, 03 May 2011 16:28:00 -0000 [thread overview]
Message-ID: <20110503162807.GN2489@adacore.com> (raw)
In-Reply-To: <20110503155348.GA2528@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
> > > 2011-03-05 Michael Snyder <msnyder@vmware.com>
> > >
> > > * elfread.c (elf_symtab_read): Stop memory leak.
> >
> > I think that's OK. A little more nervous than usual, as I had
> > to look through a fair bit of code. But you did run this change
> > past the testsuite, right?
>
> I'm going to revert this patch, because I don't think it's right.
This is what I applied on HEAD and branch...
--
Joel
[-- Attachment #2: elfread.diff --]
[-- Type: text/x-diff, Size: 1543 bytes --]
commit 86a08e4d3dcf7c0ff728083ae2b02f83ef836a09
Author: Joel Brobecker <brobecker@adacore.com>
Date: Tue May 3 17:55:06 2011 +0200
Revert "elfread.c (elf_symtab_read): Stop memory leak"
It turns out that this change is not correct, and it causes a crash
on sparc-solaris while trying to load ld.so. This is because the
memory is actually still referenced after elf_symtab_read completes.
gdb/ChangeLog:
* elfread.c (elf_symtab_read): Revert the previous change
that tried to stop a memory leak.
diff --git a/gdb/elfread.c b/gdb/elfread.c
index b9cfa13..f36c93b 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -257,7 +257,6 @@ elf_symtab_read (struct objfile *objfile, int type,
char *filesymname = "";
struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info;
int stripped = (bfd_get_symcount (objfile->obfd) == 0);
- struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
for (i = 0; i < number_of_symbols; i++)
{
@@ -482,7 +481,6 @@ elf_symtab_read (struct objfile *objfile, int type,
+ (sizeof (CORE_ADDR) * max_index));
sectinfo = (struct stab_section_info *)
xmalloc (size);
- make_cleanup (xfree, sectinfo);
memset (sectinfo, 0, size);
sectinfo->num_sections = max_index;
if (filesym == NULL)
@@ -591,7 +589,6 @@ elf_symtab_read (struct objfile *objfile, int type,
}
}
}
- do_cleanups (back_to);
}
/* Build minimal symbols named `function@got.plt' (see SYMBOL_GOT_PLT_SUFFIX)
prev parent reply other threads:[~2011-05-03 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-05 20:35 Michael Snyder
2011-03-07 11:20 ` Joel Brobecker
2011-03-07 19:51 ` Michael Snyder
2011-05-03 15:54 ` Joel Brobecker
2011-05-03 16:28 ` Joel Brobecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110503162807.GN2489@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox