From patchwork Fri Jun 26 18:57:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 29202 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 8F2D4B7067 for ; Sat, 27 Jun 2009 04:57:44 +1000 (EST) Received: by ozlabs.org (Postfix) id 7D2B7DDD04; Sat, 27 Jun 2009 04:57:44 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 11A0EDDD01 for ; Sat, 27 Jun 2009 04:57:44 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbZFZS5i (ORCPT ); Fri, 26 Jun 2009 14:57:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753561AbZFZS5i (ORCPT ); Fri, 26 Jun 2009 14:57:38 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51532 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752175AbZFZS5i (ORCPT ); Fri, 26 Jun 2009 14:57:38 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5QIvf1L021187 for ; Fri, 26 Jun 2009 14:57:41 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5QIvf1o003831 for ; Fri, 26 Jun 2009 14:57:41 -0400 Received: from liberator.sandeen.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5QIve8j030260 for ; Fri, 26 Jun 2009 14:57:40 -0400 Message-ID: <4A451A23.20307@redhat.com> Date: Fri, 26 Jun 2009 13:57:39 -0500 From: Eric Sandeen User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: ext4 development Subject: [PATCH] debugfs: don't try to fclose NULL X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org do_logdump may jump to errout if fopen(out_file) fails, but in that case out_file is NULL, and fclose will segfault. Signed-off-by: Eric Sandeen --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/debugfs/logdump.c b/debugfs/logdump.c index 4818bc6..9a7108a 100644 --- a/debugfs/logdump.c +++ b/debugfs/logdump.c @@ -259,7 +259,7 @@ void do_logdump(int argc, char **argv) close(journal_fd); errout: - if (out_file != stdout) + if (out_file && (out_file != stdout)) fclose(out_file); return;