From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11695 invoked by alias); 9 May 2013 18:49:24 -0000 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 Received: (qmail 11686 invoked by uid 89); 9 May 2013 18:49:24 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_BJ autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 09 May 2013 18:49:23 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49InLsG004746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 May 2013 14:49:22 -0400 Received: from barimba (ovpn-113-133.phx2.redhat.com [10.3.113.133]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r49InKUo018127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 9 May 2013 14:49:21 -0400 From: Tom Tromey From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 04/40] fix cleanups in som_symtab_read In-Reply-To: References: Message-Id: Date: Thu, 09 May 2013 18:49:00 -0000 MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00319.txt.bz2 This fixes som_symtab_read not to leak cleanups. * somread.c (som_symtab_read): Call do_cleanups. --- gdb/somread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/somread.c b/gdb/somread.c index db6c4d4..6c6cc14 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -46,6 +46,7 @@ static void som_symtab_read (bfd *abfd, struct objfile *objfile, struct section_offsets *section_offsets) { + struct cleanup *cleanup; struct gdbarch *gdbarch = get_objfile_arch (objfile); unsigned int number_of_symbols; int val, dynamic; @@ -65,7 +66,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, We avoid using alloca because the memory size could be so large that we could hit the stack size limit. */ buf = xmalloc (symsize * number_of_symbols); - make_cleanup (xfree, buf); + cleanup = make_cleanup (xfree, buf); bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET); val = bfd_bread (buf, symsize * number_of_symbols, abfd); if (val != symsize * number_of_symbols) @@ -316,6 +317,8 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, section), objfile); } + + do_cleanups (cleanup); } /* Scan and build partial symbols for a symbol file. -- 1.8.1.4