From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-177180.vip.163.com (mail-177180.vip.163.com [123.58.177.180]) by dpdk.org (Postfix) with ESMTP id 705391B192 for ; Wed, 5 Dec 2018 03:50:35 +0100 (CET) Received: from localhost.localdomain (unknown [116.196.72.250]) by smtp1 (Coremail) with SMTP id oGZ4CgDX3rbyPAdccN2oAw--.62312S2; Wed, 05 Dec 2018 10:50:33 +0800 (CST) From: gfree.wind@vip.163.com To: dev@dpdk.org Cc: Gao Feng Date: Wed, 5 Dec 2018 10:50:25 +0800 Message-Id: <1543978226-23480-1-git-send-email-gfree.wind@vip.163.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: oGZ4CgDX3rbyPAdccN2oAw--.62312S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF15CryDur43uF1fJF48Crg_yoWkZwb_Xw 1rArnrCr1UAFsxJa12krZ8Xr4xuF1kWa17ur4vqF1fKa4Yqay29r92vr95JFyrWw45A348 Gr13Zry7Ar1xWjkaLaAFLSUrUUUUbb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8cTm3UUUUU== X-Originating-IP: [116.196.72.250] X-CM-SenderInfo: 5jiuvvgozl0vg6yl1hqrwthudrp/1tbiBhoUs1Zhb2j0WQAAsm Subject: [dpdk-dev] [PATCH] eal: fix memleak on mp request error handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 02:50:36 -0000 From: Gao Feng When rte_eal_alarm_set failed, need to free the bundle mem in the error handler of handle_primary_request and handle_secondary_request. Signed-off-by: Gao Feng --- lib/librte_eal/common/hotplug_mp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c index 070e2e0..9d610a8 100644 --- a/lib/librte_eal/common/hotplug_mp.c +++ b/lib/librte_eal/common/hotplug_mp.c @@ -208,6 +208,8 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name) ret = rte_eal_alarm_set(1, __handle_secondary_request, bundle); if (ret != 0) { RTE_LOG(ERR, EAL, "failed to add mp task\n"); + free(bundle->peer); + free(bundle); return send_response_to_secondary(req, ret, peer); } return 0; @@ -332,6 +334,8 @@ static void __handle_primary_request(void *param) */ ret = rte_eal_alarm_set(1, __handle_primary_request, bundle); if (ret != 0) { + free(bundle->peer); + free(bundle); resp->result = ret; ret = rte_mp_reply(&mp_resp, peer); if (ret != 0) { -- 1.8.3.1