Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp321887ybg; Mon, 1 Jun 2020 02:13:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvAiHotGX7ootx7ZQ/f344pSIJKPP04+WSQop+Ut4ZepcEAmiBM/r3TeIMQPFpPC58tkda X-Received: by 2002:aa7:c617:: with SMTP id h23mr21380733edq.305.1591002814396; Mon, 01 Jun 2020 02:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591002814; cv=none; d=google.com; s=arc-20160816; b=S3sNYihLVL9cp0mo0yaoVlmKE28ougl+/6wsodg8QKzp/scpz6tcglhrosbDIMzc+O YeT2uy3SusPXz00scsxvcWJ2dS416lIoHSyS4vXXU0wb0jvf00gmyXeK1ML3ZHfa4CSl emWqZ20IeQbkancA3iLa4GBkoQfxVWgwzlpunexssSE4c0gq/89FqLZe6t+6iPqVddjW OG1qrsbdKROlAQFZ5EeZ7VdbEUp0wRB0Uo/9xXDegILGUpPNQdiLSSl8LFTEys1x8iHv Y94T5TYzDhAPG2xxl+h+vBvs8gZXEwPpod0cFzs01hgxJq5+dmSwVOfsnA6dwTiD26D2 qyxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fM7iFmZ9LqhYxFyGb+4AylZJHWYebqJcz24gV5fu9M4=; b=VGYIbk7f9OXqzXQIVUigTRYT8JUI2kCMt1piJhlvL40qSOi/soH2EJ4oUpj0RQY7Fr F4lHM/5hsJelvntKP4V16u1kXGn/Kt9xg1CUhGcXClrLGBqsag1RqCgeSmCw6EPzgZsh TqLI0jbuTow8FrzAalXTubtgsw74M+NrXbF6gujp1qI6Pse/ohsJfi9iOO7ceTr21pO8 f2G494T0m+jDe/PUMqVhUxlN3jNbhJWBtxg/SDKqlQZW9+yEccK1jhk+e9dx4u39b5ll my7CJmLa0M5udlfYZg6bKAfdUkKFcNSMwFkw9qeMeBF2c0baUwomFkkvx7ckO4lFph/9 waaA== 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 y89si9580903edy.357.2020.06.01.02.13.12; Mon, 01 Jun 2020 02:13:34 -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 S1726011AbgFAJLI (ORCPT + 99 others); Mon, 1 Jun 2020 05:11:08 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5317 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725788AbgFAJLI (ORCPT ); Mon, 1 Jun 2020 05:11:08 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7C928607764F1DC58E3B; Mon, 1 Jun 2020 17:11:06 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Mon, 1 Jun 2020 17:10:59 +0800 From: Zhihao Cheng To: , CC: , Subject: [PATCH 2/2] ubifs: dent: Fix some potential memory leaks while iterating entries Date: Mon, 1 Jun 2020 17:10:37 +0800 Message-ID: <20200601091037.3794172-2-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200601091037.3794172-1-chengzhihao1@huawei.com> References: <20200601091037.3794172-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix some potential memory leaks in error handling branches while iterating dent entries. For example, function dbg_check_dir() forgets to free pdent if it exists. Signed-off-by: Zhihao Cheng Cc: Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system") --- fs/ubifs/debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 0f5a480fe264..b4a3abf54df7 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -1123,6 +1123,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) err = PTR_ERR(dent); if (err == -ENOENT) break; + kfree(pdent); return err; } -- 2.25.4