From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27569 invoked from network); 10 Sep 2008 18:57:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Sep 2008 18:57:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 94236 invoked from network); 10 Sep 2008 18:57:41 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Sep 2008 18:57:41 -0000 Received: (qmail 5330 invoked by alias); 10 Sep 2008 18:57:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25639 Received: (qmail 5319 invoked from network); 10 Sep 2008 18:57:31 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 10 Sep 2008 18:57:31 -0000 Received: from cork.scru.org (cork.scru.org [209.20.67.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id F2351802710A for ; Wed, 10 Sep 2008 20:57:25 +0200 (CEST) Received: by cork.scru.org (Postfix, from userid 1000) id 60E8D10409A; Wed, 10 Sep 2008 18:57:24 +0000 (UTC) Date: Wed, 10 Sep 2008 18:57:24 +0000 From: Clint Adams To: zsh-workers@sunsite.dk Subject: PATCH: potential memory leak in getsubsargs Message-ID: <20080910185724.GA26412@scru.org> Mail-Followup-To: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV 0.92.1/8210/Wed Sep 10 18:26:19 2008 on bifrost X-Virus-Status: Clean ptr2 gets allocated by hdynread2() above, but does not get used if (!hsub1). Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.82 diff -u -r1.82 hist.c --- Src/hist.c 4 Sep 2008 22:27:59 -0000 1.82 +++ Src/hist.c 10 Sep 2008 18:53:22 -0000 @@ -346,8 +346,10 @@ if (strlen(ptr1)) { zsfree(hsubl); hsubl = ptr1; - } else if (!hsubl) /* fail silently on this */ + } else if (!hsubl) { /* fail silently on this */ + zsfree(ptr2); return 0; + } zsfree(hsubr); hsubr = ptr2; follow = ingetc();