From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27311 invoked from network); 21 Sep 2008 12:46:34 -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; 21 Sep 2008 12:46:34 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 45367 invoked from network); 21 Sep 2008 12:46:02 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Sep 2008 12:46:02 -0000 Received: (qmail 14152 invoked by alias); 21 Sep 2008 12:45:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25701 Received: (qmail 14134 invoked from network); 21 Sep 2008 12:45:55 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 21 Sep 2008 12:45:55 -0000 Received: from cork.scru.org (cork.scru.org [209.20.67.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id D6A26802720D for ; Sun, 21 Sep 2008 14:45:35 +0200 (CEST) Received: by cork.scru.org (Postfix, from userid 1000) id 0E2CE1040A1; Sun, 21 Sep 2008 12:45:30 +0000 (UTC) Date: Sun, 21 Sep 2008 12:45:30 +0000 From: Clint Adams To: zsh-workers@sunsite.dk Subject: PATCH: loadautofn memory leak Message-ID: <20080921124530.GA31428@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/8296/Sun Sep 21 05:04:54 2008 on bifrost X-Virus-Status: Clean getfpfunc allocates memory for fname, which was not freed one these codepaths. Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.152 diff -u -r1.152 exec.c --- Src/exec.c 16 Sep 2008 15:06:57 -0000 1.152 +++ Src/exec.c 21 Sep 2008 12:38:45 -0000 @@ -4134,10 +4134,13 @@ zwarn("%s: function definition file not found", shf->node.nam); locallevel++; popheap(); + zsfree(fname); return NULL; } - if (!prog) + if (!prog) { + zsfree(fname); return NULL; + } if (ksh == 2 || (ksh == 1 && isset(KSHAUTOLOAD))) { if (autol) { prog->flags |= EF_RUN; @@ -4174,6 +4177,7 @@ shf->filename = fname; } popheap(); + zsfree(fname); return shf; }