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: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Kirill Batuzov 2014-04-10 18:07:57 +04:00 committed by Michael Tokarev
parent b0f9300ca3
commit 00a9cacaea
1 changed files with 3 additions and 1 deletions

View File

@ -160,7 +160,9 @@ void init_paths(const char *prefix)
base = new_entry("", NULL, pref_buf);
base = add_dir_maybe(base);
if (base->num_entries == 0) {
free (base);
g_free(base->pathname);
free(base->name);
free(base);
base = NULL;
} else {
set_parents(base, base);