From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2102 invoked by alias); 7 Jan 2015 07:14:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34155 Received: (qmail 18021 invoked from network); 7 Jan 2015 07:14:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Kc1larcG c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=fMqbXuGjffpxPolEkKEA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150106231454.ZM26126@torch.brasslantern.com> Date: Tue, 06 Jan 2015 23:14:54 -0800 In-reply-to: <150106230807.ZM13656@torch.brasslantern.com> Comments: In reply to Bart Schaefer "PATCH (differently) Re: PATCH: Plug some fd leaks in bin_print" (Jan 6, 11:08pm) References: <1420590318-17047-1-git-send-email-mikachu@gmail.com> <150106223532.ZM1050@torch.brasslantern.com> <150106230807.ZM13656@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Subject: Re: PATCH (differently) Re: PATCH: Plug some fd leaks in bin_print MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 6, 11:08pm, Bart Schaefer wrote: } } Does coverity still find leaks after this? What I've done is to move } option validity checking earlier in the function so that fout should } never get opened in the first place if we're not going to make proper } use of it later. Oops, forgot to delete a couple of lines from a copy-paste: } + if (fmt && !*args) { } + if (fout != stdout) } + fclose(fout); } + return 0; } + } fout is always stdout there, so that can just be + if (fmt && !*args) + return 0; I won't resend the entire diff unless somebody needs it.