qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 056/108] block/vvfat: Plug memory leak in read_direc


From: Michael Roth
Subject: [Qemu-devel] [PATCH 056/108] block/vvfat: Plug memory leak in read_directory()
Date: Wed, 6 Aug 2014 15:39:06 -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 1978c9e..439a603 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.9.1




reply via email to

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