1
mirror of https://code.videolan.org/videolan/vlc synced 2024-07-29 11:58:24 +02:00

Simplify and streamline CD-DA open error error logic. Remove a compilation

warning, guard against dereferencing more unitialized pointers.
This commit is contained in:
Rocky Bernstein 2004-11-30 04:14:19 +00:00
parent b2b37ee9d5
commit 2448f5e441

View File

@ -344,7 +344,8 @@ int E_(CDDAOpen)( vlc_object_t *p_this )
if( !(p_cdio = cdio_open( psz_source, DRIVER_UNKNOWN )) ) if( !(p_cdio = cdio_open( psz_source, DRIVER_UNKNOWN )) )
{ {
msg_Warn( p_access, "could not open %s", psz_source ); msg_Warn( p_access, "could not open %s", psz_source );
goto error2; if (psz_source) free( psz_source );
return VLC_EGENERIC;
} }
p_cdda = malloc( sizeof(cdda_data_t) ); p_cdda = malloc( sizeof(cdda_data_t) );
@ -446,13 +447,13 @@ int E_(CDDAOpen)( vlc_object_t *p_this )
error: error:
cdio_destroy( p_cdda->p_cdio ); cdio_destroy( p_cdda->p_cdio );
free( p_cdda ); if( psz_source) free( psz_source );
error2: if( p_cdda ) {
free( psz_source ); if ( p_cdda->p_input )
if( p_cdda && p_cdda->p_input ) vlc_object_release( p_cdda->p_input );
{ free(p_cdda);
vlc_object_release( p_cdda->p_input );
} }
return i_rc; return i_rc;
} }
@ -479,7 +480,7 @@ void E_(CDDAClose)( vlc_object_t *p_this )
cdio_log_set_handler (uninit_log_handler); cdio_log_set_handler (uninit_log_handler);
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
cddb_log_set_handler (uninit_log_handler); cddb_log_set_handler ((cddb_log_handler_t) uninit_log_handler);
if (p_cdda->b_cddb_enabled) if (p_cdda->b_cddb_enabled)
cddb_disc_destroy(p_cdda->cddb.disc); cddb_disc_destroy(p_cdda->cddb.disc);
#endif #endif