[vlc-commits] cdda: simplify and fix invalid free on error
Rémi Denis-Courmont
git at videolan.org
Wed Jan 15 17:53:29 CET 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jan 15 18:43:51 2020 +0200| [01988299f11d9b3e911fcd2929b147047980003e] | committer: Rémi Denis-Courmont
cdda: simplify and fix invalid free on error
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=01988299f11d9b3e911fcd2929b147047980003e
---
modules/access/cdda.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index 982c220c45..42d0e7c6ca 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -470,13 +470,10 @@ static musicbrainz_recording_t * GetMusicbrainzInfo( vlc_object_t *obj,
else /* Fuzzy lookup using TOC */
{
struct vlc_memstream ms;
- if( vlc_memstream_open(&ms) )
- {
- free( psz_mbserver );
- return NULL;
- }
+ vlc_memstream_open(&ms);
vlc_memstream_printf(&ms, "toc=%u+%u", i_first, i_last );
+
/* LEAD OUT sector info
* https://github.com/metabrainz/libdiscid/blob/e46249415eb6d657ecc63667b03d670a4347712f/src/toc.c#L90 */
int i_last_track_end;
@@ -487,18 +484,11 @@ static musicbrainz_recording_t * GetMusicbrainzInfo( vlc_object_t *obj,
vlc_memstream_printf(&ms, "+%u", i_last_track_end );
for( int i = 0; i<i_total; i++ ) /* skipped LEAD OUT, audio only */
vlc_memstream_printf(&ms, "+%u", LBAPregap(p_toc->p_sectors[i].i_lba) );
- if( vlc_memstream_flush(&ms) )
- {
- if( vlc_memstream_close(&ms) )
- free( ms.ptr );
- free( psz_mbserver );
- return NULL;
- }
-
- recording = musicbrainz_lookup_recording_by_toc( &cfg, ms.ptr );
-
if( vlc_memstream_close(&ms) == 0 )
+ {
+ recording = musicbrainz_lookup_recording_by_toc( &cfg, ms.ptr );
free( ms.ptr );
+ }
}
free( psz_mbserver );
More information about the vlc-commits
mailing list