From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23909 invoked by alias); 1 Aug 2007 02:14:58 -0000 Received: (qmail 23901 invoked by uid 22791); 1 Aug 2007 02:14:58 -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; Wed, 01 Aug 2007 02:14:56 +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 l712ErJY014750; Tue, 31 Jul 2007 19:14:53 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Tue, 31 Jul 2007 19:14:53 -0700 (PDT) Message-ID: <10015.12.7.175.2.1185934493.squirrel@webmail.sonic.net> Date: Wed, 01 Aug 2007 02:14:00 -0000 Subject: PATCH: readline/histexpand.c, resource leak From: msnyder@sonic.net To: gdb-patches@sourceware.org, bug-readline@gnu.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070731191453_17962" 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/msg00005.txt.bz2 ------=_20070731191453_17962 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 0 ------=_20070731191453_17962 Content-Type: text/plain; name="130.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="130.txt" Content-length: 983 2007-07-31 Michael Snyder * histexpand.c (history_find_word): Resource leak. Index: histexpand.c =================================================================== RCS file: /cvs/src/src/readline/histexpand.c,v retrieving revision 1.6 diff -p -r1.6 histexpand.c *** histexpand.c 5 May 2006 18:26:12 -0000 1.6 --- histexpand.c 1 Aug 2007 02:08:51 -0000 *************** history_find_word (line, ind) *** 1581,1588 **** int i, wind; words = history_tokenize_internal (line, ind, &wind); ! if (wind == -1 || words == 0) return ((char *)NULL); s = words[wind]; for (i = 0; i < wind; i++) free (words[i]); --- 1581,1594 ---- int i, wind; words = history_tokenize_internal (line, ind, &wind); ! if (words == NULL) return ((char *)NULL); + if (wind == -1) + { + free (words); + return ((char *)NULL); + } + s = words[wind]; for (i = 0; i < wind; i++) free (words[i]); ------=_20070731191453_17962--