From 96afbb3778e0f69f5113610150f5851a812f0fc4 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Sun, 2 Oct 2011 20:04:44 +0000 Subject: [PATCH] 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 --- apps/filetypes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/filetypes.c b/apps/filetypes.c index d275c6501c..1f19d25e5a 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) -- 2.11.4.GIT