Skip to contentSkip to conversation

bus/platform: fix resource leak

PATCH Applied Tomasz Duszynski 2 participants 2 messages Mar 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/platform: fix resource leak

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")
---
 drivers/bus/platform/platform_params.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/platform/platform_params.c +3 -1
index edc246b53e..0eb8eb56e7 100644
@@ -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);
Signature · 1 line
2.34.1
#1 lore raw

16/03/2023 09:14, Tomasz Duszynski:

Quoted 7 lines

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")

Applied, thanks.