From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z7H-0005EY-Lo for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:24:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4Z6O-00013J-EV for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:23:43 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:54890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z6N-00012m-VY for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:22:48 -0400 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jul 2014 11:22:47 -0600 From: Michael Roth Date: Tue, 8 Jul 2014 12:18:39 -0500 Message-Id: <1404839947-1086-129-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 128/156] block/vvfat: Plug memory leak in read_directory() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org From: Markus Armbruster 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 --- 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