]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Detail.c: fix memleak in Detail()
authorWu Guanghao <wuguanghao3@huawei.com>
Fri, 3 Mar 2023 16:21:32 +0000 (00:21 +0800)
committerJes Sorensen <jes@trained-monkey.org>
Wed, 8 Mar 2023 18:54:30 +0000 (13:54 -0500)
char *sysdev = xstrdup() but not free() in for loop, will cause memory
leak

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Detail.c

index ce7a844543181df1d1ed274a3ebeac46324a5dd8..4ef2646075665503e60b4880f5ecc284cf5f6035 100644 (file)
--- 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;