qemu-stable
[Top][All Lists]
Advanced

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

[Qemu-stable] [PATCH 128/156] block/vvfat: Plug memory leak in read_dire


From: Michael Roth
Subject: [Qemu-stable] [PATCH 128/156] block/vvfat: Plug memory leak in read_directory()
Date: Tue, 8 Jul 2014 12:18:39 -0500

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>
(cherry picked from commit b122c3b6d020e529b203836efb8f611ece787293)
Signed-off-by: Michael Roth <address@hidden>
---
 block/vvfat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/vvfat.c b/block/vvfat.c
index e71d71e..e9e4fad 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -788,7 +788,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.9.1




reply via email to

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