mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
This commit is contained in:
parent
5064485c0c
commit
96afbb3778
1 changed files with 4 additions and 2 deletions
|
@ -345,16 +345,19 @@ void filetype_init(void)
|
||||||
strdup_bufsize = filesize(fd);
|
strdup_bufsize = filesize(fd);
|
||||||
strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops);
|
strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops);
|
||||||
if (strdup_handle < 0)
|
if (strdup_handle < 0)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
read_builtin_types();
|
read_builtin_types();
|
||||||
read_config(fd);
|
read_config(fd);
|
||||||
|
close(fd);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
read_viewer_theme_file();
|
read_viewer_theme_file();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
read_color_theme_file();
|
read_color_theme_file();
|
||||||
#endif
|
#endif
|
||||||
close(fd);
|
|
||||||
core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
|
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);
|
file_type->icon = Icon_Last_Themeable + atoi(s);
|
||||||
filetype_count++;
|
filetype_count++;
|
||||||
}
|
}
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int filetype_get_attr(const char* file)
|
int filetype_get_attr(const char* file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue