mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
apps: fix close of negative fd in talk.c
Bug reported by UBSan. Change-Id: I02276521510acac8696499895fec15993c55aaf6
This commit is contained in:
parent
e5e457b526
commit
dadfbfc6a5
1 changed files with 5 additions and 4 deletions
|
@ -552,8 +552,8 @@ alloc_err:
|
||||||
}
|
}
|
||||||
static inline int load_voicefile_failure(int fd)
|
static inline int load_voicefile_failure(int fd)
|
||||||
{
|
{
|
||||||
/*if (fd >= 0) probably redundant */
|
if (fd >= 0)
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* load the voice file into the mp3 buffer */
|
/* load the voice file into the mp3 buffer */
|
||||||
|
@ -829,7 +829,7 @@ void talk_init(void)
|
||||||
* and so we can re-use it if it's already allocated in any event */
|
* and so we can re-use it if it's already allocated in any event */
|
||||||
|
|
||||||
filehandle = open_voicefile();
|
filehandle = open_voicefile();
|
||||||
if (filehandle > -1)
|
if (filehandle >= 0)
|
||||||
{
|
{
|
||||||
if (!load_voicefile_index(filehandle))
|
if (!load_voicefile_index(filehandle))
|
||||||
{
|
{
|
||||||
|
@ -880,7 +880,8 @@ void talk_init(void)
|
||||||
voice_thread_init();
|
voice_thread_init();
|
||||||
|
|
||||||
out:
|
out:
|
||||||
close(filehandle); /* close again, this was just to detect presence */
|
if (filehandle >= 0)
|
||||||
|
close(filehandle); /* close again, this was just to detect presence */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* somebody else claims the mp3 buffer, e.g. for regular play/record */
|
/* somebody else claims the mp3 buffer, e.g. for regular play/record */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue