From: Kirill Batuzov Date: Thu, 10 Apr 2014 14:07:57 +0000 (+0400) Subject: init_paths: fix minor memory leak X-Git-Tag: v2.1.0-rc0~160^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00a9cacaea9afa4cb72871d1067bb21f75dcc3bd;p=thirdparty%2Fqemu.git 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 Signed-off-by: Michael Tokarev --- diff --git a/util/path.c b/util/path.c index 623219e4c5f..5c59d9f1d3b 100644 --- a/util/path.c +++ b/util/path.c @@ -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);