diff options
author | Thomas Jarosch <tomj@simonv.com> | 2011-10-02 20:04:44 +0000 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2011-10-02 20:04:44 +0000 |
commit | 96afbb3778e0f69f5113610150f5851a812f0fc4 (patch) | |
tree | 6119bbb16f8ec0694e0cd17f98d157672f5e2bc9 /apps/filetypes.c | |
parent | 5064485c0c03f28b8d096e468859fa6b75be62a7 (diff) | |
download | rockbox-96afbb3778e0f69f5113610150f5851a812f0fc4.tar.gz rockbox-96afbb3778e0f69f5113610150f5851a812f0fc4.zip |
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
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r-- | apps/filetypes.c | 6 |
1 files 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) | |||
345 | strdup_bufsize = filesize(fd); | 345 | strdup_bufsize = filesize(fd); |
346 | strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops); | 346 | strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops); |
347 | if (strdup_handle < 0) | 347 | if (strdup_handle < 0) |
348 | { | ||
349 | close(fd); | ||
348 | return; | 350 | return; |
351 | } | ||
349 | read_builtin_types(); | 352 | read_builtin_types(); |
350 | read_config(fd); | 353 | read_config(fd); |
354 | close(fd); | ||
351 | #ifdef HAVE_LCD_BITMAP | 355 | #ifdef HAVE_LCD_BITMAP |
352 | read_viewer_theme_file(); | 356 | read_viewer_theme_file(); |
353 | #endif | 357 | #endif |
354 | #ifdef HAVE_LCD_COLOR | 358 | #ifdef HAVE_LCD_COLOR |
355 | read_color_theme_file(); | 359 | read_color_theme_file(); |
356 | #endif | 360 | #endif |
357 | close(fd); | ||
358 | core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx); | 361 | core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx); |
359 | } | 362 | } |
360 | 363 | ||
@@ -437,7 +440,6 @@ static void read_config(int fd) | |||
437 | file_type->icon = Icon_Last_Themeable + atoi(s); | 440 | file_type->icon = Icon_Last_Themeable + atoi(s); |
438 | filetype_count++; | 441 | filetype_count++; |
439 | } | 442 | } |
440 | close(fd); | ||
441 | } | 443 | } |
442 | 444 | ||
443 | int filetype_get_attr(const char* file) | 445 | int filetype_get_attr(const char* file) |