diff options
author | Wu Guanghao <wuguanghao3@huawei.com> | 2023-03-04 00:21:31 +0800 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-03-08 13:54:30 -0500 |
commit | 06ef619582b47af89eb094c164fc5effd46d6048 (patch) | |
tree | 832778b3241f68dc93a1dd05504323105cadd3b1 | |
parent | a0151041642dffff2421c22e18fb7b02b58787d9 (diff) | |
download | mdadm-06ef619582b47af89eb094c164fc5effd46d6048.tar.gz |
util.c: fix memleak in parse_layout_faulty()
char *m is allocated by xstrdup but not free() before return, will cause
a 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>
-rw-r--r-- | util.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -432,6 +432,8 @@ int parse_layout_faulty(char *layout) m = xstrdup(layout); m[ln] = 0; mode = map_name(faultylayout, m); + free(m); + if (mode == UnSet) return -1; |