From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7DC25A034E; Sat, 12 Feb 2022 13:40:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4269F41177; Sat, 12 Feb 2022 13:40:10 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A64C240691 for ; Sat, 12 Feb 2022 13:40:08 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21CAQkoA030937 for ; Sat, 12 Feb 2022 04:40:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=RivGl13ckBCsS1UpeW3RPM1Q1pV29RZU1eGDSZaeP7s=; b=Hs24KP3pFqC6fD/sxY4k0t252lq9Juz0+0LWt5W/7ncE7RDhGrdtQF9whIAZcObdnek6 pbxe/6n90JggotEPhZiB+A5WdTuTGeo6WWv9LBdrh2Peo4fncwL6ek//wvmCErw58UZJ WDsDaP7Wl37pjL6eBL2z2F1OuUnFDLfHlzUxUktj4qALT8p+WvtBA644AbdSF+btiZuh lnkdEFyff/8in4y4/WLVbYPy2cVRLxWYxc3z7s/Qpgwb8KZMD+FtyiUq9Bs64YEoC35R fKqZSD5gQUbEib/dYcTfmv63AFLZHXAbrPda1tryrei9bzxpkZaNkju4Mcz0i2vsFuVQ YQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3e6b4rr8p4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 12 Feb 2022 04:40:07 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 12 Feb 2022 04:40:06 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Sat, 12 Feb 2022 04:40:06 -0800 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 828395B6947; Sat, 12 Feb 2022 04:40:04 -0800 (PST) From: Gowrishankar Muthukrishnan To: CC: Pavan Nikhilesh , Shijith Thotton , , Gowrishankar Muthukrishnan Subject: [PATCH 2/3] event/cnxk: fix memory leak Date: Sat, 12 Feb 2022 18:09:47 +0530 Message-ID: <20220212123948.3394407-2-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220212123948.3394407-1-gmuthukrishn@marvell.com> References: <20220212123948.3394407-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: mA1sM_0TnyjSggSbWwGn8uRVw4SgevSL X-Proofpoint-GUID: mA1sM_0TnyjSggSbWwGn8uRVw4SgevSL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-12_04,2022-02-11_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Fix memory leaks reported in coverity scan. Fixes: 8a3d58c189f ("event/cnxk: add option to control timer adapters") Coverity issue: 374990 374991 Signed-off-by: Gowrishankar Muthukrishnan --- drivers/event/cnxk/cnxk_tim_evdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c index 4d22ac6ac3..af67235503 100644 --- a/drivers/event/cnxk/cnxk_tim_evdev.c +++ b/drivers/event/cnxk/cnxk_tim_evdev.c @@ -560,7 +560,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque) char *f = s; if (s == NULL || !strlen(s)) - return; + goto free; while (*s) { if (*s == '[') @@ -579,6 +579,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque) s++; } +free: free(f); } @@ -607,7 +608,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque) int i = 0; if (str == NULL || !strlen(str)) - return; + goto free; tok = strtok(str, "-"); while (tok != NULL && src[i] != ROC_TIM_CLK_SRC_INVALID) { @@ -616,6 +617,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque) i++; } +free: free(str); } -- 2.25.1