Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4791964pxu; Wed, 21 Oct 2020 05:38:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycVGWcJR6kB7gmCJ3JlfK5zVR2B9ebSM24zsWXwsQCbDih8GaTnvWleJ4t16sjHGDkrjEz X-Received: by 2002:a17:906:1446:: with SMTP id q6mr3367972ejc.549.1603283917183; Wed, 21 Oct 2020 05:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603283917; cv=none; d=google.com; s=arc-20160816; b=G8oXmlvAPaMfkeOEdkdpq9fHpQ6IvxxCBfmE4Mn5bszHxLf+2GU7hlAzsM/euF0XEJ yX23XsKkXul2wUgKfcNc5Kp4cWL6hAzROthbj9c3jvMd+VEjfS3HyJ4LLMmkoH/bL/7K CTJb5TY98LVPNKickgeToC8S9eV9acmsJhvg6j+QPgRadA1yLb0OJsvmXz+qYK+BwP94 Tr68A4tEeYbZLYBS8LnAACdBFhsetjktVQW5WTta6EYxfjlzx+w4Z/eM3BeJKXKTYEjp 6lu5jhehuQqkMNyMw9GfcpEz9g39I4a+AbKDdQUtoSPmNHHqqRqQCTEDGTw1yYmpWYME QLDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=9J51Xudv7sQJfz+hGWdRdbXFWVCIqylI6eNYKt66RZk=; b=RVQ7fdtdzoqN04aIF96RwHccuUU0K5Gyvo6nC0nYweWk+DjzlP1EkaMkqHFv88IVqI cGc4ApPkCOTbEEfRkwVwyhdqut8d6lq0CrXUOBjMyEba3U+PAfYPFIoaGTv/6OFTi8iN naQlobFluvG2hn4yZpD7a1b60132c2YGfDj5lczmYvuVW/yDOUnHzpJWqlCYqFhxd7pr rYVDKqEycP8II8dMUGXwmS1OlFr4uyQWo1dN8dG51ku/QDxkK31lFJJ25WYeE9OtXBWO B2zBgqDfwG2bMzcyB9hVMCHGQHdCcl4LjD/9UzAv25TZKYr3S3WWpOC6RjqwuXw4/h9e EegA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si1270433edq.372.2020.10.21.05.38.15; Wed, 21 Oct 2020 05:38:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408375AbgJUFhX (ORCPT + 99 others); Wed, 21 Oct 2020 01:37:23 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:58454 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2408265AbgJUFhX (ORCPT ); Wed, 21 Oct 2020 01:37:23 -0400 Received: from localhost.localdomain (unknown [210.32.148.79]) by mail-app3 (Coremail) with SMTP id cC_KCgAXT5z4yI9fbU9RAA--.37365S4; Wed, 21 Oct 2020 13:37:00 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod Date: Wed, 21 Oct 2020 13:36:55 +0800 Message-Id: <20201021053655.28624-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgAXT5z4yI9fbU9RAA--.37365S4 X-Coremail-Antispam: 1UD129KBjvdXoWrAFyftrW5AF4UCF4kur1xZrb_yoWxWFbEka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ing-List: linux-kernel@vger.kernel.org There is one error handling path does not free ref, which may cause a memory leak. Signed-off-by: Dinghao Liu --- fs/btrfs/ref-verify.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index 7f03dbe5b609..78693d3dd15b 100644 --- a/fs/btrfs/ref-verify.c +++ b/fs/btrfs/ref-verify.c @@ -860,6 +860,7 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info, "dropping a ref for a root that doesn't have a ref on the block"); dump_block_entry(fs_info, be); dump_ref_action(fs_info, ra); + kfree(ref); kfree(ra); goto out_unlock; } -- 2.17.1