From 08089edcd25b2105a7599309afd0225e839debc6 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Wed, 12 Jan 2011 19:48:58 +0000 Subject: [PATCH] vvfat: fix a file descriptor leak Fix a file descriptor leak, reported by cppcheck: [/src/qemu/block/vvfat.c:759]: (error) Resource leak: dir Signed-off-by: Blue Swirl --- block/vvfat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/vvfat.c b/block/vvfat.c index 26dd474bb5..fe568fe2c7 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -756,6 +756,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) if (st.st_size > 0x7fffffff) { fprintf(stderr, "File %s is larger than 2GB\n", buffer); free(buffer); + closedir(dir); return -2; } direntry->size=cpu_to_le32(S_ISDIR(st.st_mode)?0:st.st_size);