From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18740 invoked by alias); 10 Nov 2008 20:51:30 -0000 Received: (qmail 18697 invoked by uid 22791); 10 Nov 2008 20:51:30 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Nov 2008 20:50:53 +0000 Received: (qmail 30870 invoked from network); 10 Nov 2008 20:50:51 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Nov 2008 20:50:51 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, Tom Tromey Subject: Re: RFA: fix crash-causing bug in copy_type_recursive Date: Mon, 10 Nov 2008 21:22:00 -0000 User-Agent: KMail/1.9.10 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811102046.13626.pedro@codesourcery.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: 2008-11/txt/msg00197.txt.bz2 On Monday 10 November 2008 19:40:01, Tom Tromey wrote: > On the Python branch I ran into a crash that was caused by > copy_type_recursive not clearing the memory for new fields. > Built and regtested on x86-64 (compile farm). > Ok? (I almost checked this in as obvious...) > Ok. > @@ -2977,6 +2977,7 @@ copy_type_recursive (struct objfile *objfile, > > nfields = TYPE_NFIELDS (type); > TYPE_FIELDS (new_type) = xmalloc (sizeof (struct field) * nfields); > + memset (TYPE_FIELDS (new_type), 0, sizeof (struct field) * nfields); Or xzalloc, or xcalloc, or XCALLOC even. -- Pedro Alves