From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5584 invoked by alias); 2 Aug 2011 17:02:16 -0000 Received: (qmail 5572 invoked by uid 22791); 2 Aug 2011 17:02:15 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Aug 2011 17:01:56 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p72H1uYW031992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Aug 2011 13:01:56 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p72H1sHh016775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 2 Aug 2011 13:01:55 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p72H1rBN025357 for ; Tue, 2 Aug 2011 19:01:53 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p72H1r2e025356 for gdb-patches@sourceware.org; Tue, 2 Aug 2011 19:01:53 +0200 Date: Tue, 02 Aug 2011 17:02:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Make test-cp-name-parser usable Message-ID: <20110802170152.GA24932@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00031.txt.bz2 Hi, I found during `make test-cp-name-parser' a dead-loop #0 0x00000000004065ef in xfree (ptr=0x623a40) at cp-name-parser.y:2108 #1 0x00000000004065f4 in xfree (ptr=0x623a40) at cp-name-parser.y:2108 #2 0x00000000004065f4 in xfree (ptr=0x623a40) at cp-name-parser.y:2108 I do not see how easily enough to fix it and I do not think a small memory leak matters for a test program. And also a bit misleading that parsing errors were not indicated. That commented string was already there during initial check-in. Thanks, Jan gdb/ 2011-08-02 Jan Kratochvil * cp-name-parser.y (xfree): Remove the call of free. (main): Uncomment "Demangling error\n". --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -2036,13 +2036,12 @@ trim_chars (char *lexptr, char **extra_chars) } /* When this file is built as a standalone program, xmalloc comes from - libiberty --- in which case we have to provide xfree ourselves. */ + libiberty --- in which case we have to provide xfree ourselves. + A call to free would get translated xfree back again. Leak is OK. */ void xfree (void *ptr) { - if (ptr != NULL) - free (ptr); } int @@ -2071,7 +2070,7 @@ main (int argc, char **argv) str2 = cplus_demangle (buf, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE); if (str2 == NULL) { - /* printf ("Demangling error\n"); */ + printf ("Demangling error\n"); if (c) printf ("%s%c%s\n", buf, c, extra_chars); else