projects
/
sdk
/
emulator
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dabdf39
)
vvfat: avoid leaking file descriptor in commit_one_file()
author
Stefan Hajnoczi
<stefanha@linux.vnet.ibm.com>
Fri, 6 Jan 2012 16:57:44 +0000
(16:57 +0000)
committer
Stefan Hajnoczi
<stefanha@linux.vnet.ibm.com>
Fri, 13 Jan 2012 10:36:59 +0000
(10:36 +0000)
Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
block/vvfat.c
patch
|
blob
|
history
diff --git
a/block/vvfat.c
b/block/vvfat.c
index eeffc4a4a81ce370eb16da642243e550fd90d527..9ef21ddfc5ec7d6a18643f872dc2811356f03b6f 100644
(file)
--- a/
block/vvfat.c
+++ b/
block/vvfat.c
@@
-2218,6
+2218,7
@@
static int commit_one_file(BDRVVVFATState* s,
}
if (offset > 0) {
if (lseek(fd, offset, SEEK_SET) != offset) {
+ close(fd);
g_free(cluster);
return -3;
}
@@
-2238,11
+2239,13
@@
static int commit_one_file(BDRVVVFATState* s,
(uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);
if (ret < 0) {
+ close(fd);
g_free(cluster);
return ret;
}
if (write(fd, cluster, rest_size) < 0) {
+ close(fd);
g_free(cluster);
return -2;
}