summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-05-16 12:52:50 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-05-16 12:52:50 +0000
commit784c625f331ec0326fe462f0fa58a67ba23fd9ee (patch)
treecfe67cceb6b1854ad2d3f0d00fed2c62ef3be42a /uisimulator
parent05fcd0b0e2958d47f9463dfca978ad904faaa282 (diff)
downloadrockbox-784c625f331ec0326fe462f0fa58a67ba23fd9ee.tar.gz
rockbox-784c625f331ec0326fe462f0fa58a67ba23fd9ee.zip
close the file too properly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@585 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/bmp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/uisimulator/bmp.c b/uisimulator/bmp.c
index 404869fcf2..85a0fd2ffe 100644
--- a/uisimulator/bmp.c
+++ b/uisimulator/bmp.c
@@ -122,6 +122,7 @@ int read_bmp_file(char* filename,
sizeof(struct Fileheader))
{
debugf("error - can't Read Fileheader Stucture\n");
+ close(fd);
return 2;
}
@@ -130,6 +131,7 @@ int read_bmp_file(char* filename,
{
debugf("error - Bitmap must be less than 8, got %d\n",
readshort(fh.BitCount));
+ close(fd);
return 2;
}
@@ -138,6 +140,7 @@ int read_bmp_file(char* filename,
{
debugf("error - Bitmap is too wide (%d pixels, max is 112)\n",
readlong(fh.Width));
+ close(fd);
return 3;
}
debugf("Bitmap is %d pixels wide\n", readlong(fh.Width));
@@ -147,6 +150,7 @@ int read_bmp_file(char* filename,
{
debugf("error - Bitmap is too high (%d pixels, max is 64)\n",
readlong(fh.Height));
+ close(fd);
return 4;
}
debugf("Bitmap is %d pixels heigh\n", readlong(fh.Height));
@@ -157,6 +161,7 @@ int read_bmp_file(char* filename,
sizeof(struct RGBQUAD))
{
debugf("error - Can't read bitmap's color palette\n");
+ close(fd);
return 5;
}
}
@@ -192,12 +197,14 @@ int read_bmp_file(char* filename,
if(bmp == NULL)
{
debugf("error - Out of memory\n");
+ close(fd);
return 6;
}
else
{
if(read(fd, (unsigned char*)bmp,(long)size) != size) {
debugf("error - Can't read image\n");
+ close(fd);
return 7;
}
}
@@ -249,6 +256,7 @@ int read_bmp_file(char* filename,
#endif
}
+ close(fd);
return 0; /* success */
}