From: Markus Armbruster Date: Wed, 28 May 2014 09:17:05 +0000 (+0200) Subject: block/vvfat: Plug memory leak in read_directory() X-Git-Tag: qemu-xen-4.5.0-rc1^2~63 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a3e3f0964d42c2f0e6806014806afce75303abe2;p=qemu-upstream-4.5-testing.git 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 (cherry picked from commit b122c3b6d020e529b203836efb8f611ece787293) Signed-off-by: Michael Roth --- diff --git a/block/vvfat.c b/block/vvfat.c index 1978c9ed6..439a603c2 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);