From b122c3b6d020e529b203836efb8f611ece787293 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 28 May 2014 11:17:05 +0200 Subject: [PATCH] block/vvfat: Plug memory leak in read_directory() Has always been leaky. Spotted by Coverity. Signed-off-by: Markus Armbruster Reviewed-by: Benoit Canet Signed-off-by: Kevin Wolf --- 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); -- 2.7.4