From b36d3c0be228fbf7ad1b193d11d8a3365a045a43 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Tue, 15 Apr 2008 19:20:57 +0000 Subject: [PATCH] =?UTF-8?q?Some=20bugfixes=20after=20r17109:=20*=20Fix=20F?= =?UTF-8?q?S#8893=20by=20plugging=20a=20file=20descriptor=20leak=20in=20au?= =?UTF-8?q?dio=5Fload=5Ftrack.=20*=20Fix=20a=20possible=20null=20pointer?= =?UTF-8?q?=20dereference=20by=20not=20allowing=20audio=5Fcurrent=5Ftrack?= =?UTF-8?q?=20to=20return=20NULL.=20*=20Make=20audio=5Fcurrent=5Ftrack=20r?= =?UTF-8?q?eturn=20prevtrack=5Fid3=20only=20during=20an=20automatic=20trac?= =?UTF-8?q?k=20skip.=20Fixes=20the=20wrong=20metadata=20being=20displayed?= =?UTF-8?q?=20for=20a=20short=20time=20after=20a=20backwards=20skip.=20-Ce?= =?UTF-8?q?tte=20ligne,=20et=20les=20suivantes=20ci-dessous,=20seront=20ig?= =?UTF-8?q?nor=C3=A9es--?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M apps/playback.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17126 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index bce4b6b030..38da93b6c7 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -552,7 +552,7 @@ struct mp3entry* audio_current_track(void) /* The usual case */ return &curtrack_id3; } - else if (offset == -1 && *prevtrack_id3.path) + else if (automatic_skip && offset == -1 && *prevtrack_id3.path) { /* We're in a track transition. The codec has moved on to the nex track, but the audio being played is still the same (now previous) track. @@ -563,7 +563,8 @@ struct mp3entry* audio_current_track(void) else if (tracks[cur_idx].id3_hid >= 0) { /* Get the ID3 metadata from the main buffer */ - return bufgetid3(tracks[cur_idx].id3_hid); + struct mp3entry *ret = bufgetid3(tracks[cur_idx].id3_hid); + if (ret) return ret; } /* We didn't find the ID3 metadata, so we fill temp_id3 with the little info @@ -1648,8 +1649,6 @@ static bool audio_load_track(size_t offset, bool start_play) return false; } - close(fd); - if (track_widx == track_ridx) { buf_request_buffer_handle(tracks[track_widx].id3_hid); @@ -1664,6 +1663,7 @@ static bool audio_load_track(size_t offset, bool start_play) } } + close(fd); return true; }