qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_director


From: Kevin Wolf
Subject: [Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_directory()
Date: Mon, 2 Jun 2014 15:56:43 +0200

From: Markus Armbruster <address@hidden>

Has always been leaky.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 block/vvfat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/vvfat.c b/block/vvfat.c
index 56370c5..3cda19f 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -787,7 +787,9 @@ static int read_directory(BDRVVVFATState* s, int 
mapping_index)
            s->current_mapping->path=buffer;
            s->current_mapping->read_only =
                (st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) == 0;
-       }
+        } else {
+            g_free(buffer);
+        }
     }
     closedir(dir);
 
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]