summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2011-10-02 20:04:44 +0000
committerThomas Jarosch <tomj@simonv.com>2011-10-02 20:04:44 +0000
commit96afbb3778e0f69f5113610150f5851a812f0fc4 (patch)
tree6119bbb16f8ec0694e0cd17f98d157672f5e2bc9
parent5064485c0c03f28b8d096e468859fa6b75be62a7 (diff)
downloadrockbox-96afbb3778e0f69f5113610150f5851a812f0fc4.zip
rockbox-96afbb3778e0f69f5113610150f5851a812f0fc4.tar.gz
rockbox-96afbb3778e0f69f5113610150f5851a812f0fc4.tar.bz2
rockbox-96afbb3778e0f69f5113610150f5851a812f0fc4.tar.xz
Fix file descriptor double close():
read_config() also closed the file descriptor. Credit goes to cppcheck. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30699 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/filetypes.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index d275c65..1f19d25 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -345,16 +345,19 @@ void filetype_init(void)
strdup_bufsize = filesize(fd);
strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops);
if (strdup_handle < 0)
+ {
+ close(fd);
return;
+ }
read_builtin_types();
read_config(fd);
+ close(fd);
#ifdef HAVE_LCD_BITMAP
read_viewer_theme_file();
#endif
#ifdef HAVE_LCD_COLOR
read_color_theme_file();
#endif
- close(fd);
core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
}
@@ -437,7 +440,6 @@ static void read_config(int fd)
file_type->icon = Icon_Last_Themeable + atoi(s);
filetype_count++;
}
- close(fd);
}
int filetype_get_attr(const char* file)