From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5269 invoked by alias); 18 Aug 2007 20:15:40 -0000 Received: (qmail 5204 invoked by uid 22791); 18 Aug 2007 20:15:39 -0000 X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 18 Aug 2007 20:15:36 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l7IKFJNW025438; Sat, 18 Aug 2007 13:15:19 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Sat, 18 Aug 2007 13:15:19 -0700 (PDT) Message-ID: <11112.12.7.175.2.1187468119.squirrel@webmail.sonic.net> In-Reply-To: <46C7528D.2000002@case.edu> References: <10015.12.7.175.2.1185934493.squirrel@webmail.sonic.net> <46C7528D.2000002@case.edu> Date: Sat, 18 Aug 2007 20:15:00 -0000 Subject: Re: [Bug-readline] Re: PATCH: readline/histexpand.c, resource leak From: msnyder@sonic.net To: chet.ramey@case.edu Cc: "Jim Blandy" , msnyder@sonic.net, bug-readline@gnu.org, gdb-patches@sourceware.org, chet@case.edu User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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: 2007-08/txt/msg00380.txt.bz2 > Jim Blandy wrote: >> It seems to me that 'words' is a malloc'ed array of malloc'ed strings, >> so 'free (words)' still leaks storage. > > I don't believe there's a case where wind == -1 and any malloced strings > exist in words[]. There's no leak unless that can happen. Well, that isn't locally obvious -- it depends on knowing the behavior of other code. You may be right -- but the free won't do any harm, and in case you're wrong (now or in the future), the free will catch it.