* [PATCH] common/dpaax: fix a memory leak in iterate dir
@ 2022-02-18 17:32 Weiguo Li
0 siblings, 0 replies; only message in thread
From: Weiguo Li @ 2022-02-18 17:32 UTC (permalink / raw)
To: hemant.agrawal; +Cc: shreyansh.jain, dev
Release the memory when error occur.
Fixes: 2183c6f69d7e ("bus/dpaa: add OF parser for device scanning")
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
drivers/common/dpaax/dpaa_of.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/common/dpaax/dpaa_of.c b/drivers/common/dpaax/dpaa_of.c
index bb2c8fc66b..a827b42efa 100644
--- a/drivers/common/dpaax/dpaa_of.c
+++ b/drivers/common/dpaax/dpaa_of.c
@@ -126,8 +126,10 @@ iterate_dir(struct dirent **d, int num, struct dt_dir *dt)
d[loop]->d_name);
subdir->parent = dt;
ret = process_dir(subdir->node.node.full_name, subdir);
- if (ret)
+ if (ret) {
+ free(subdir);
return ret;
+ }
list_add_tail(&subdir->node.list, &dt->subdirs);
break;
default:
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-18 17:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 17:32 [PATCH] common/dpaax: fix a memory leak in iterate dir Weiguo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).