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]

[PATCH] issues in bcache_xmalloc calls.


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


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