Thread (17 messages) read the whole thread 17 messages, 3 authors, 2022-06-07

Re: [PATCH 1/5] parse_layout_faulty: fix memleak

From: Wu Guanghao <hidden>
Date: 2022-06-07 07:24:52

在 2022/5/31 15:36, Mariusz Tkaczyk 写道:
On Tue, 31 May 2022 14:49:17 +0800
Wu Guanghao [off-list ref] wrote:
quoted
char *m is allocated by xstrdup but not free() before return, will cause
a memory leak

Signed-off-by: Wu Guanghao <redacted>
---
 util.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/util.c b/util.c
index cc94f96e..da18a68d 100644
--- a/util.c
+++ b/util.c
@@ -429,6 +429,7 @@ int parse_layout_faulty(char *layout)
 	int mode;
 	m[ln] = 0;
 	mode = map_name(faultylayout, m);
+	free(m);
 	if (mode == UnSet)
 		return -1;
Hi,
Please add empty lines to separate declarations and not related code
sections.
Thanks for your reply. I will be modified in PATCH v2.
Thanks,
Mariusz

.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help