Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] issues in bcache_xmalloc calls.
@ 2011-08-26  9:23 matt rice
  2011-08-26 12:06 ` Pedro Alves
  2011-08-26 16:56 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: matt rice @ 2011-08-26  9:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: matt rice

While doing the macro patches, I noticed these 2 things,
though i have not tried it solib-sunos.c seems as though it should not compile
for almost a year, I didn't see a bug report or email so I'm going to go out on
a limb and say its relatively unused.

earlier in reread_symbols the bcaches are allocated, and it looks like a leak
to me... don't see any way to cause it to free in the inbetween.  Just in case,
i set these up as uninitialized values and ran the testsuite to make sure.
it was covered by gdb.base/reread.exp.

2011-08-26  Matt Rice  <ratmice@gmail.com>

        * solib-sunos.c (allocate_rt_common_objfile): Add missing arguments to
        bcache_xmalloc.
        * symfile.c (reread_symbols): Remove extra calls to bcache_xmalloc.
---
 gdb/solib-sunos.c |    6 +++---
 gdb/symfile.c     |    3 ---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index 405ca4f..5bf765d 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -189,9 +189,9 @@ allocate_rt_common_objfile (void)
 
   objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
   memset (objfile, 0, sizeof (struct objfile));
-  objfile->psymbol_cache = bcache_xmalloc ();
-  objfile->macro_cache = bcache_xmalloc ();
-  objfile->filename_cache = bcache_xmalloc ();
+  objfile->psymbol_cache = bcache_xmalloc (NULL, NULL);
+  objfile->macro_cache = bcache_xmalloc (NULL, NULL);
+  objfile->filename_cache = bcache_xmalloc (NULL, NULL);
   obstack_init (&objfile->objfile_obstack);
   objfile->name = xstrdup ("rt_common");
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index aca907a..bb233c9 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2472,9 +2472,6 @@ reread_symbols (void)
 	  memset (&objfile->msymbol_demangled_hash, 0,
 		  sizeof (objfile->msymbol_demangled_hash));
 
-	  objfile->psymbol_cache = psymbol_bcache_init ();
-	  objfile->macro_cache = bcache_xmalloc (NULL, NULL);
-	  objfile->filename_cache = bcache_xmalloc (NULL, NULL);
 	  /* obstack_init also initializes the obstack so it is
 	     empty.  We could use obstack_specify_allocation but
 	     gdb_obstack.h specifies the alloc/dealloc
-- 
1.7.4.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-27 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26  9:23 [PATCH] issues in bcache_xmalloc calls matt rice
2011-08-26 12:06 ` Pedro Alves
2011-08-26 16:56 ` Tom Tromey
2011-08-27 10:38   ` Matt Rice

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox