From patchwork Tue Dec 30 14:57:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 5552641 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 565EE9F2B9 for ; Tue, 30 Dec 2014 14:57:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B8FE2010E for ; Tue, 30 Dec 2014 14:57:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 819F820160 for ; Tue, 30 Dec 2014 14:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751784AbaL3O5j (ORCPT ); Tue, 30 Dec 2014 09:57:39 -0500 Received: from cantor2.suse.de ([195.135.220.15]:50397 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751683AbaL3O5j (ORCPT ); Tue, 30 Dec 2014 09:57:39 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2DDC2ABFC for ; Tue, 30 Dec 2014 14:57:38 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id AEC95DA88A; Tue, 30 Dec 2014 15:57:37 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 1/5] btrfs-progs: check, fix path leak in error branch Date: Tue, 30 Dec 2014 15:57:37 +0100 Message-Id: <0665aaf5a3733c5153e7fc0959d813c6ff76ee34.1419951036.git.dsterba@suse.cz> X-Mailer: git-send-email 2.1.3 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Resolves-coverity-id: 1260250 Signed-off-by: David Sterba --- cmds-check.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index e74b116c0c43..71e4f4f3a13b 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -2839,7 +2839,7 @@ static int repair_btree(struct btrfs_root *root, ret = PTR_ERR(trans); fprintf(stderr, "Error starting transaction: %s\n", strerror(-ret)); - return ret; + goto out_free_path; } cache = first_cache_extent(corrupt_blocks); while (cache) { @@ -2894,8 +2894,9 @@ static int repair_btree(struct btrfs_root *root, cache = next_cache_extent(cache); } out: - btrfs_free_path(path); btrfs_commit_transaction(trans, root); +out_free_path: + btrfs_free_path(path); return ret; }