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 9BE7C41EAC; Thu, 16 Mar 2023 09:15:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86ED540FDF; Thu, 16 Mar 2023 09:15:04 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 28F0240EF1 for ; Thu, 16 Mar 2023 09:15:02 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32G5eCl7022229 for ; Thu, 16 Mar 2023 01:15:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=bIxCVMVkqZZ7EufSh5B6WsendUbFTOjOaRTtjZDCNso=; b=HjeOXOXfnB/9AJ0c8hDSFRMeiIkSVC6iZxL0UZ4nDXWDF9NKwsX1OuBNRRf5OUKF4ZEJ PW9xvp/bnGLQWVFnKZGTOgLI+wEJnqPUhpQ7wCxEeoY9SJSWVONDBkPSX9rYkizPbOjQ M6gEc8Xb2BuJ1PDcEZvPIypuGYGGsbPQ7rR4TB9xXHsg3AYN6zrT+Wd3PfT+CnigrXXE WWPu7sjZ8gqIVSbWEhm+vGIEO8Rp1/wV4xrqVuJeiFd54qRCLkZeD0PhiCi72HCflAAL CYxoWoVgoMsugNOanPwegQM2pmg9KyJ4PzKj886rcysNfHt+0GXC+kbbWbqib40Y8RgZ sg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3pbs2u181n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 16 Mar 2023 01:15:01 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 16 Mar 2023 01:14:59 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 16 Mar 2023 01:14:59 -0700 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 38B643F703F; Thu, 16 Mar 2023 01:14:57 -0700 (PDT) From: Tomasz Duszynski To: , Tomasz Duszynski Subject: [PATCH] bus/platform: fix resource leak Date: Thu, 16 Mar 2023 09:14:55 +0100 Message-ID: <20230316081455.3352891-1-tduszynski@marvell.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: l2y6NIvPmHpOtpSnhl4qBpz4NaucqT1t X-Proofpoint-ORIG-GUID: l2y6NIvPmHpOtpSnhl4qBpz4NaucqT1t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-16_06,2023-03-15_01,2023-02-09_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 On error function may return without releasing some allocated resources which causes a memory leak. Fix it. Coverity issue: 383660 Fixes: 17c839f74da3 ("bus: add platform bus") Signed-off-by: Tomasz Duszynski --- drivers/bus/platform/platform_params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/bus/platform/platform_params.c b/drivers/bus/platform/platform_params.c index edc246b53e..0eb8eb56e7 100644 --- a/drivers/bus/platform/platform_params.c +++ b/drivers/bus/platform/platform_params.c @@ -63,8 +63,10 @@ platform_bus_dev_iterate(const void *start, const char *str, } find_device = platform_bus.bus.find_device; - if (find_device == NULL) + if (find_device == NULL) { + rte_kvargs_free(kvargs); return NULL; + } dev = platform_bus.bus.find_device(start, platform_dev_match, kvargs); rte_kvargs_free(kvargs); -- 2.34.1