[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/18] init_paths: fix minor memory leak
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 15/18] init_paths: fix minor memory leak |
Date: |
Mon, 28 Apr 2014 09:08:01 +0400 |
From: Kirill Batuzov <address@hidden>
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 <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
util/path.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/path.c b/util/path.c
index 623219e..5c59d9f 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);
--
1.7.10.4
- [Qemu-devel] [PULL 05/18] move test-* from .gitignore to tests/.gitignore, (continued)
- [Qemu-devel] [PULL 05/18] move test-* from .gitignore to tests/.gitignore, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 04/18] configure: Improve help behavior, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 12/18] Add QEMU logo (SVG file), Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 06/18] tests/.gitignore: Ignore test-rfifolock, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 13/18] net/net.c: remove unnecessary semicolon, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 18/18] slirp/smb: Move ncalrpc directory to tmp, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 09/18] vl: Eliminate a superfluous local variable, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 08/18] vl: Remove useless 'continue', Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 16/18] po/Makefile: fix $SRC_PATH reference, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 15/18] init_paths: fix minor memory leak,
Michael Tokarev <=
- [Qemu-devel] [PULL 11/18] vl: avoid closing stdout with 'writeconfig', Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 10/18] xilinx: Fix typo in comment (Marvel -> Marvell), Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 17/18] po: add proper Language : tags to .po files, Michael Tokarev, 2014/04/28
- [Qemu-devel] [PULL 14/18] virtfs-proxy-helper: fix call to accept, Michael Tokarev, 2014/04/28
- Re: [Qemu-devel] [PULL 00/18] Trivial patches for 2014-04-28, Peter Maydell, 2014/04/28