From patchwork Mon Oct 7 06:36:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 2994281 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F41199F245 for ; Mon, 7 Oct 2013 06:36:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1ECA9201BD for ; Mon, 7 Oct 2013 06:36:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96B462017A for ; Mon, 7 Oct 2013 06:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752676Ab3JGGg1 (ORCPT ); Mon, 7 Oct 2013 02:36:27 -0400 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:55319 "EHLO e23smtp03.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711Ab3JGGg0 (ORCPT ); Mon, 7 Oct 2013 02:36:26 -0400 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Oct 2013 16:36:24 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 Oct 2013 16:36:23 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 13DE03578052 for ; Mon, 7 Oct 2013 17:36:22 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r976JRGw57409540 for ; Mon, 7 Oct 2013 17:19:27 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r976aKM1023232 for ; Mon, 7 Oct 2013 17:36:20 +1100 Received: from localhost.localdomain ([9.124.35.192]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r976aCQ5022963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 7 Oct 2013 17:36:20 +1100 From: chandan To: linux-btrfs@vger.kernel.org Cc: sekharan@us.ibm.com, dsterba@suse.cz Subject: [PATCH] btrfs-progs: btrfs_list_find_updated_files: Fix memory leak. Date: Mon, 07 Oct 2013 12:06:11 +0530 Message-ID: <10157896.KS57RD9T2T@localhost.localdomain> User-Agent: KMail/4.11.1 (Linux/3.11.2-201.fc19.x86_64; KDE/4.11.1; x86_64; ; ) MIME-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13100706-6102-0000-0000-00000449E3CE 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 The current code returns from the function when the call to ioctl fails. This may leak cache_dir_name and cache_full_name. Fix it. Signed-off-by: chandan --- btrfs-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrfs-list.c b/btrfs-list.c index 9cadbf5..9411e4d 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -1686,7 +1686,7 @@ int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen) if (ret < 0) { fprintf(stderr, "ERROR: can't perform the search- %s\n", strerror(e)); - return ret; + break; } /* the ioctl returns the number of item it found in nr_items */ if (sk->nr_items == 0)