From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13538 invoked from network); 19 Jan 2009 08:22:24 -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; 19 Jan 2009 08:22:24 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 83065 invoked from network); 19 Jan 2009 08:22:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Jan 2009 08:22:18 -0000 Received: (qmail 9928 invoked by alias); 19 Jan 2009 08:22:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26362 Received: (qmail 9918 invoked from network); 19 Jan 2009 08:22:12 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Jan 2009 08:22:12 -0000 Received: from randymail-a10.g.dreamhost.com (sd-green-bigip-145.dreamhost.com [208.97.132.145]) by bifrost.dotsrc.org (Postfix) with ESMTP id EF6BE80271F0 for ; Mon, 19 Jan 2009 09:22:08 +0100 (CET) Received: from blorf.net (dsl-74-220-65-6.cruzio.com [74.220.65.6]) by randymail-a10.g.dreamhost.com (Postfix) with ESMTP id 0C585D0882 for ; Mon, 19 Jan 2009 00:22:06 -0800 (PST) Date: Mon, 19 Jan 2009 00:22:04 -0800 From: Wayne Davison To: zsh-workers@sunsite.dk Subject: [PATCH] don't call regfree() on uninitialized regex_t Message-ID: <20090119082203.GA16606@blorf.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-Virus-Scanned: ClamAV 0.92.1/8876/Mon Jan 19 05:24:48 2009 on bifrost X-Virus-Status: Clean --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline While I was fixing a few compiler warnings in zcond_regex_match(), I noticed that regfree() could be called on an uninitialized regex_t if the "id" value passed in to the function was invalid. Attached is one possible fix. ..wayne.. --yrj/dFKFPuw6o+aM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="regex.patch" --- Src/Modules/regex.c 19 Jan 2009 08:00:15 -0000 1.4 +++ Src/Modules/regex.c 19 Jan 2009 08:14:25 -0000 @@ -120,7 +120,7 @@ zcond_regex_match(char **a, int id) break; default: DPUTS(1, "bad regex option"); - break; + return 0; /* nothing to cleanup, especially not "re". */ } if (matches) --yrj/dFKFPuw6o+aM--