From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3539 invoked from network); 14 Apr 2008 13:27:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) 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.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 14 Apr 2008 13:27:54 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 37548 invoked from network); 14 Apr 2008 13:27:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Apr 2008 13:27:48 -0000 Received: (qmail 20991 invoked by alias); 14 Apr 2008 13:27:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24812 Received: (qmail 20974 invoked from network); 14 Apr 2008 13:27:44 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 14 Apr 2008 13:27:44 -0000 Received: from prunille.vinc17.org (vinc17.pck.nerim.net [213.41.242.187]) by bifrost.dotsrc.org (Postfix) with ESMTP id ED9AF808B1FD for ; Mon, 14 Apr 2008 15:27:36 +0200 (CEST) Received: by prunille.vinc17.org (Postfix, from userid 501) id 6961E218D312; Mon, 14 Apr 2008 15:27:35 +0200 (CEST) Date: Mon, 14 Apr 2008 15:27:35 +0200 From: Vincent Lefevre To: zsh-workers@sunsite.dk Subject: Possible memory leak in hist.c Message-ID: <20080414132735.GT1223@prunille.vinc17.org> Mail-Followup-To: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.17-vl-r21552 (2008-03-11) X-Virus-Scanned: ClamAV 0.91.2/6759/Mon Apr 14 14:56:05 2008 on bifrost X-Virus-Status: Clean Hi, Say that savehistfile is called with err = 0 and that unlink(tmpfile) fails (hist.c, line 2204). Then it seems that tmpfile will never be free'd because all the "free(tmpfile);" are in conditions that will always be false. Wouldn't it be simpler to replace all the "free(tmpfile);" by if (tmpfile) { free(tmpfile); } at the end? -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)