Received: from eggs.gnu.org ([2001:4830:134:3::10]:41240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSjd-0002IE-So for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:57:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrSjX-0003SV-D1 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:57:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSjX-0003SE-4z for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:57:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s52Dv2ZM009826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 2 Jun 2014 09:57:02 -0400 From: Kevin Wolf Date: Mon, 2 Jun 2014 15:56:43 +0200 Message-Id: <1401717408-4607-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1401717408-4607-1-git-send-email-kwolf@redhat.com> References: <1401717408-4607-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 12/17] 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: kwolf@redhat.com From: Markus Armbruster 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); -- 1.8.3.1