From patchwork Mon Oct 7 21:43:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zach Brown X-Patchwork-Id: 2999371 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BACDEBF925 for ; Mon, 7 Oct 2013 21:43:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 011D0201F9 for ; Mon, 7 Oct 2013 21:43:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29F1E201EF for ; Mon, 7 Oct 2013 21:43:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753855Ab3JGVne (ORCPT ); Mon, 7 Oct 2013 17:43:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35326 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753572Ab3JGVnR (ORCPT ); Mon, 7 Oct 2013 17:43:17 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r97LhHWd003431 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Oct 2013 17:43:17 -0400 Received: from lenny.home.zabbo.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r97LhC9S003268; Mon, 7 Oct 2013 17:43:17 -0400 From: Zach Brown To: linux-btrfs@vger.kernel.org, Eric Sandeen Subject: [PATCH 08/12] btrfs-progs: don't leak path in verify_space_cache Date: Mon, 7 Oct 2013 14:43:01 -0700 Message-Id: <1381182185-10896-9-git-send-email-zab@redhat.com> In-Reply-To: <1381182185-10896-1-git-send-email-zab@redhat.com> References: <1381182185-10896-1-git-send-email-zab@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This was found by static analysis. Signed-off-by: Zach Brown Reviewed-by: chandan --- cmds-check.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index ebba58e..b6035d7 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3228,13 +3228,13 @@ static int verify_space_cache(struct btrfs_root *root, ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); if (ret < 0) - return ret; + goto out; ret = 0; while (1) { if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { ret = btrfs_next_leaf(root, path); if (ret < 0) - return ret; + goto out; if (ret > 0) { ret = 0; break; @@ -3274,6 +3274,8 @@ static int verify_space_cache(struct btrfs_root *root, ret = check_cache_range(root, cache, last, cache->key.objectid + cache->key.offset - last); + +out: btrfs_free_path(path); if (!ret &&