bus/platform: fix resource leak
Checks
Commit Message
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 <tduszynski@marvell.com>
---
drivers/bus/platform/platform_params.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
16/03/2023 09:14, Tomasz Duszynski:
> 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 <tduszynski@marvell.com>
Applied, thanks.
@@ -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);