]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
init_paths: fix minor memory leak
authorKirill Batuzov <batuzovk@ispras.ru>
Thu, 10 Apr 2014 14:07:57 +0000 (18:07 +0400)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 28 Apr 2014 04:55:32 +0000 (08:55 +0400)
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>
util/path.c

index 623219e4c5f4b0300e69d8034eb42d2ebc9bf5c4..5c59d9f1d3bf33a8b6ce6556d2f53b6397d53eab 100644 (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);