Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3331447pxj; Mon, 24 May 2021 04:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypTjxO1JQZQs9Kj0Qy1vRdnRjSFnKQ740oo2gRJ6CznKI3ff1QkootAsBuBWy9FULFc/nP X-Received: by 2002:a50:f385:: with SMTP id g5mr25615103edm.222.1621855402611; Mon, 24 May 2021 04:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621855402; cv=none; d=google.com; s=arc-20160816; b=JpSqs1F8GOLOW7FzRyf5IfmQvU3SxpEsfb9R4GKdEmWdE59USrVsg/+XRqLE2kxarC JLzpbHRHCSyVi1wyhvg4gW0p55bCtA/+Yt3ITcNwhzaYn49VS/9D1i5hrNciMCh//dH9 P6rTa48oVKxcj1T7u35Ay4dSyM1YZ3XoXaxvtlGOHlvSw8DgIzdtjAKZNQJbospmQmYb dCmWu6m/baSHCGZcuDOADRrL4u7jWMRiSeBWeFjNgd/LBNTJs4iYW2dSIlp4crePqZLK hj83Q7inS/vLnxxcAmWpz29VjHpZ4lCiBBWAPIHXSyejXgXringdfZE2tylHLalbGrHW fxFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:from :subject; bh=eskhXhtuZrEWcOuWr+0d8DpDoVzWXqU57PTjRi2/iYo=; b=sLVzp7X3zxD2HuI9t2IxlAWYI8YGXcPlwYKnZC5MsL0EG19Sy/BvpB5UtXW6oDWrao Xh22kWyG0qkeJ5ZzMrigrfvTpNPjW3SRbP4EaHODh4mLAOe0oWtEOqspthNg9e8tuWWy iCkGTo+B0Tk7Q+9lnBqAn2YcnOZ666bHCoNuYm272mz4cTCVkdRUNae6XVAUPzPW+6/c DOTjZULDWMSguN9qx3gftdf/zWYSkGju1G0vyi/kpXqY6P9BWEXQhf6Pw5SVeUeQaXkt c6E5XOYvmaCJISGLIaBLziIvze02CvHcBQuZTaC6fcIHPmtGJTq1hCLWksWKJ86sYAHJ VM4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si14055910ejj.467.2021.05.24.04.22.59; Mon, 24 May 2021 04:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232516AbhEXLVw (ORCPT + 99 others); Mon, 24 May 2021 07:21:52 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5535 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232675AbhEXLVv (ORCPT ); Mon, 24 May 2021 07:21:51 -0400 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FpZSD2bmSzkXP3 for ; Mon, 24 May 2021 19:17:32 +0800 (CST) Received: from dggpemm500014.china.huawei.com (7.185.36.153) by dggems706-chm.china.huawei.com (10.3.19.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 24 May 2021 19:20:22 +0800 Received: from [10.174.179.184] (10.174.179.184) by dggpemm500014.china.huawei.com (7.185.36.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 24 May 2021 19:20:22 +0800 Subject: [PATCH 02/12] tdb_transaction_recover: fix memory leak From: Wu Guanghao To: CC: , References: <266bc52e-e279-ce84-0e1f-1405b9bc6174@huawei.com> Message-ID: <4018590a-34ba-9744-366c-a66682824f11@huawei.com> Date: Mon, 24 May 2021 19:20:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.1 MIME-Version: 1.0 In-Reply-To: <266bc52e-e279-ce84-0e1f-1405b9bc6174@huawei.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.184] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500014.china.huawei.com (7.185.36.153) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In tdb_transaction_recover(), need free data before return, otherwise it will cause memory leak. Signed-off-by: Wu Guanghao Signed-off-by: Zhiqiang Liu Reviewed-by: Wu Bo --- lib/ext2fs/tdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ext2fs/tdb.c b/lib/ext2fs/tdb.c index 5091b128..ddfcf130 100644 --- a/lib/ext2fs/tdb.c +++ b/lib/ext2fs/tdb.c @@ -2186,6 +2186,7 @@ int tdb_transaction_recover(struct tdb_context *tdb) rec.data_len, 0) == -1) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n")); tdb->ecode = TDB_ERR_IO; + free(data); return -1; } --