Message ID | e6c9be61-f217-3b6b-35f6-0b8474c4527a@huawei.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Jes Sorensen |
Headers | show |
Series | mdadm: fix memory leak and double free | expand |
On Tue, 31 May 2022 14:49:46 +0800 Wu Guanghao <wuguanghao3@huawei.com> wrote: > char *sysdev = xstrdup() but not free() in for loop, will cause memory > leak > > Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com> > --- > Detail.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Detail.c b/Detail.c > index ce7a8445..4ef26460 100644 > --- a/Detail.c > +++ b/Detail.c > @@ -303,6 +303,7 @@ int Detail(char *dev, struct context *c) > if (path) > printf("MD_DEVICE_%s_DEV=%s\n", > sysdev, path); > + free(sysdev); > } > } > goto out; Acked-by: mariusz.tkaczyk@linux.intel.com
diff --git a/Detail.c b/Detail.c index ce7a8445..4ef26460 100644 --- a/Detail.c +++ b/Detail.c @@ -303,6 +303,7 @@ int Detail(char *dev, struct context *c) if (path) printf("MD_DEVICE_%s_DEV=%s\n", sysdev, path); + free(sysdev); } } goto out;
char *sysdev = xstrdup() but not free() in for loop, will cause memory leak Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com> --- Detail.c | 1 + 1 file changed, 1 insertion(+)