From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 818 invoked by alias); 24 Jun 2014 14:18:49 -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 807 invoked by uid 89); 24 Jun 2014 14:18:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_05,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga03.intel.com Received: from mga03.intel.com (HELO mga03.intel.com) (143.182.124.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jun 2014 14:18:46 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 24 Jun 2014 07:18:07 -0700 X-ExtLoop1: 1 Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by azsmga001.ch.intel.com with ESMTP; 24 Jun 2014 07:18:06 -0700 Received: from irsmsx105.ger.corp.intel.com (163.33.3.28) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 24 Jun 2014 15:17:21 +0100 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.106]) by IRSMSX105.ger.corp.intel.com ([169.254.7.76]) with mapi id 14.03.0123.003; Tue, 24 Jun 2014 15:17:20 +0100 From: "Metzger, Markus T" To: Tom Tromey CC: "palves@redhat.com" , "gdb-patches@sourceware.org" Subject: RE: [PATCH v2 1/3] make_corefile_notes: have caller free returned memory Date: Tue, 24 Jun 2014 14:18:00 -0000 Message-ID: References: <1403599872-25299-1-git-send-email-markus.t.metzger@intel.com> <87ionq4e2l.fsf@fleche.redhat.com> In-Reply-To: <87ionq4e2l.fsf@fleche.redhat.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00856.txt.bz2 > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Tom Tromey > Sent: Tuesday, June 24, 2014 3:45 PM > To: Metzger, Markus T > Cc: palves@redhat.com; gdb-patches@sourceware.org > Subject: Re: [PATCH v2 1/3] make_corefile_notes: have caller free returned > memory >=20 > >>>>> "Markus" =3D=3D Markus Metzger writes: >=20 > Markus> if (note_data =3D=3D NULL || note_size =3D=3D 0) > Markus> error (_("Target does not support core file generation.")); >=20 > Markus> + cleanup =3D make_cleanup (xfree, note_data); >=20 > I wonder if it is possible for note_data!=3DNULL but note_size=3D=3D0. I don't know. I have not found such a case, but that only means that I have not looked hard enough. I found a case where note_data =3D=3D NULL but note_size could be > 0 in linux_spu_make_corefile_notes in linux-tdep.c, which is similarly odd. Other code in the same file is only checking note_data, not note_size. > If it is possible, then the cleanup ought to be moved earlier. > (FWIW it's ok to have an xfree cleanup with a NULL argument.) I'll do that. Thanks for pointing out this bug. > Or if it is not possible, then I suppose the code just above is in > error... not your problem but if you happen to know, I would like to fix > it up. Replacing note_data and note_size with struct buffer would be nice, but the change would be quite big, I'm afraid. Regards, Markus. Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052