From patchwork Mon Oct 19 11:37:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 7435241 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AD52ABEEA4 for ; Mon, 19 Oct 2015 11:49:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1059206E6 for ; Mon, 19 Oct 2015 11:49:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA80E206E0 for ; Mon, 19 Oct 2015 11:49:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750985AbbJSLtJ (ORCPT ); Mon, 19 Oct 2015 07:49:09 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34104 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbbJSLtI (ORCPT ); Mon, 19 Oct 2015 07:49:08 -0400 Received: by padhk11 with SMTP id hk11so28288278pad.1 for ; Mon, 19 Oct 2015 04:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vk7SUrYHfRjQglH2INrj53Uy/jXl4YvNlSx38rqsMdg=; b=g+tzzEZ3w9KRSKTqleA2kOI423SEA/BzkMwtEPJJZcspdATDNkZ4RIZqT3EJ3pfs5R DRKmYt3LxpYY/IjMR0UKSF7XE7n1kQW21e6NT8zMPueM48+8er6Fuuemnf+fFveMRO5S FXw8qPRh7ghey9xnX7SWnbqPPXkXOqT10keOYUXvPCJ0msmEdzAcqp8FrDoTGAOICaKS uWh8uF+1oVSSJ9q0SotyzaT6yrfCYjzVzP19jW9Kv2p2KI62EJJkLRUqocXjGl9ZXdQE wiUyWIoVT6zYQnkWwJQNvFPPGIkq95bmtPspZUOnAPW+prkeMoh9lZD1PaNHqskslpbA 8aHQ== X-Received: by 10.66.97.102 with SMTP id dz6mr35008515pab.29.1445255348001; Mon, 19 Oct 2015 04:49:08 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id ez2sm35982008pbb.5.2015.10.19.04.49.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 04:49:07 -0700 (PDT) From: Eryu Guan To: linux-btrfs@vger.kernel.org Cc: Eryu Guan Subject: [PATCH 09/10] btrfs-progs: fix memory leak in cmd_qgroup_show() Date: Mon, 19 Oct 2015 19:37:59 +0800 Message-Id: <1445254680-11102-10-git-send-email-guaneryu@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> References: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 filter_set and comparer_set should be freed on return. Signed-off-by: Eryu Guan --- cmds-qgroup.c | 2 ++ qgroup.c | 1 + 2 files changed, 3 insertions(+) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 48c1733..82bd2e2 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -354,6 +354,8 @@ static int cmd_qgroup_show(int argc, char **argv) fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", path); + btrfs_qgroup_free_filter_set(filter_set); + btrfs_qgroup_free_comparer_set(comparer_set); return 1; } diff --git a/qgroup.c b/qgroup.c index ec9a3ac..0272aa8 100644 --- a/qgroup.c +++ b/qgroup.c @@ -1211,6 +1211,7 @@ int btrfs_show_qgroups(int fd, __free_all_qgroups(&qgroup_lookup); btrfs_qgroup_free_filter_set(filter_set); + btrfs_qgroup_free_comparer_set(comp_set); return ret; }