From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32746 invoked by alias); 26 Aug 2011 09:23:09 -0000 Received: (qmail 32736 invoked by uid 22791); 26 Aug 2011 09:23:08 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BJ,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Aug 2011 09:22:44 +0000 Received: by gyg10 with SMTP id 10so2871304gyg.0 for ; Fri, 26 Aug 2011 02:22:44 -0700 (PDT) Received: by 10.231.69.9 with SMTP id x9mr1843198ibi.18.1314350563874; Fri, 26 Aug 2011 02:22:43 -0700 (PDT) Received: from localhost.localdomain (c-98-232-221-4.hsd1.or.comcast.net [98.232.221.4]) by mx.google.com with ESMTPS id f7sm19848ibd.23.2011.08.26.02.22.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Aug 2011 02:22:43 -0700 (PDT) From: matt rice To: gdb-patches@sourceware.org Cc: matt rice Subject: [PATCH] issues in bcache_xmalloc calls. Date: Fri, 26 Aug 2011 09:23:00 -0000 Message-Id: <1314350550-15312-1-git-send-email-ratmice@gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00477.txt.bz2 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 * 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