From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13220 invoked from network); 8 Sep 2008 22:14:26 -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; 8 Sep 2008 22:14:26 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 4479 invoked from network); 8 Sep 2008 22:14:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Sep 2008 22:14:19 -0000 Received: (qmail 15593 invoked by alias); 8 Sep 2008 22:14:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25636 Received: (qmail 15584 invoked from network); 8 Sep 2008 22:14:11 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 8 Sep 2008 22:14:11 -0000 Received: from cork.scru.org (cork.scru.org [209.20.67.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 049FE802710A for ; Tue, 9 Sep 2008 00:14:06 +0200 (CEST) Received: by cork.scru.org (Postfix, from userid 1000) id AA06010409A; Mon, 8 Sep 2008 22:14:05 +0000 (UTC) Date: Mon, 8 Sep 2008 22:14:05 +0000 From: Clint Adams To: zsh-workers@sunsite.dk Subject: PATCH: possible memory leak in expandcmdpath Message-ID: <20080908221405.GA25660@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/8195/Mon Sep 8 23:18:48 2008 on bifrost X-Virus-Status: Clean There are 60 other potential leaks identified by the source code scanner. I have no idea if any of them are significant. Index: Src/Zle/zle_tricky.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v retrieving revision 1.95 diff -u -r1.95 zle_tricky.c --- Src/Zle/zle_tricky.c 16 May 2008 09:37:56 -0000 1.95 +++ Src/Zle/zle_tricky.c 8 Sep 2008 22:11:02 -0000 @@ -2834,8 +2834,14 @@ noaliases = 1; s = getcurcmd(); noaliases = na; - if (!s || cmdwb < 0 || cmdwe < cmdwb) + if (!s) return 1; + + if (cmdwb < 0 || cmdwe < cmdwb) { + zsfree(s); + return 1; + } + str = findcmd(s, 1); zsfree(s); if (!str)