提交 00a9caca 编写于 作者: K Kirill Batuzov 提交者: Michael Tokarev

init_paths: fix minor memory leak

Fields "name" (created with strdup in new_entry) and "pathname"
(created with g_strdup_printf in new_entry) of pathelem struct should
be freed before the whole struct is.
Signed-off-by: NKirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 b0f9300c
...@@ -160,7 +160,9 @@ void init_paths(const char *prefix) ...@@ -160,7 +160,9 @@ void init_paths(const char *prefix)
base = new_entry("", NULL, pref_buf); base = new_entry("", NULL, pref_buf);
base = add_dir_maybe(base); base = add_dir_maybe(base);
if (base->num_entries == 0) { if (base->num_entries == 0) {
free (base); g_free(base->pathname);
free(base->name);
free(base);
base = NULL; base = NULL;
} else { } else {
set_parents(base, base); set_parents(base, base);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册