Commit 69dd295b authored by Gildas Bazin's avatar Gildas Bazin

* ALL: fixed a bunch of memory leaks.
parent 4e9d7900
......@@ -2,7 +2,7 @@
* tools.c: tools for dvd plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: tools.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: tools.c,v 1.2 2002/10/23 21:54:33 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -97,12 +97,14 @@ char * dvdplay_ParseCL( input_thread_t * p_input,
return NULL;
}
psz_source = config_GetPsz( p_input, "dvd" );
if( !psz_source ) return NULL;
}
if( stat( psz_source, &stat_info ) == -1 )
{
msg_Err( p_input, "cannot stat() source `%s' (%s)",
psz_source, strerror(errno));
free( psz_source );
return NULL;
}
if( !S_ISBLK(stat_info.st_mode) &&
......@@ -111,6 +113,7 @@ char * dvdplay_ParseCL( input_thread_t * p_input,
{
msg_Dbg( p_input, "plugin discarded"
" (not a valid source)" );
free( psz_source );
return NULL;
}
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input.c,v 1.4 2002/08/30 22:22:24 massiot Exp $
* $Id: input.c,v 1.5 2002/10/23 21:54:33 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -236,7 +236,6 @@ static int DvdReadRewind( input_thread_t * p_input )
int E_(OpenDVD) ( vlc_object_t *p_this )
{
input_thread_t * p_input = (input_thread_t *)p_this;
char * psz_orig;
char * psz_parser;
char * psz_source;
char * psz_next;
......@@ -249,8 +248,8 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
int i_angle = 1;
int i;
psz_orig = psz_parser = psz_source = strdup( p_input->psz_name );
if( !psz_orig )
psz_parser = psz_source = strdup( p_input->psz_name );
if( !psz_source )
{
return( -1 );
}
......@@ -289,18 +288,20 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
if( !*psz_source )
{
free( psz_source );
if( !p_input->psz_access )
{
free( psz_orig );
return -1;
}
psz_source = config_GetPsz( p_input, "dvd" );
if( !psz_source ) return -1;
}
if( stat( psz_source, &stat_info ) == -1 )
{
msg_Err( p_input, "cannot stat() source `%s' (%s)",
psz_source, strerror(errno));
free( psz_source );
return( -1 );
}
if( !S_ISBLK(stat_info.st_mode) &&
......@@ -308,6 +309,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
!S_ISDIR(stat_info.st_mode) )
{
msg_Warn( p_input, "dvdread module discarded (not a valid source)" );
free( psz_source );
return -1;
}
......@@ -318,9 +320,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
p_dvdread = DVDOpen( psz_source );
/* free allocated strings */
if( psz_source != psz_orig )
free( psz_source );
free( psz_orig );
if( ! p_dvdread )
{
......
......@@ -2,7 +2,7 @@
* demux.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: demux.c,v 1.2 2002/08/24 21:35:31 sigmunau Exp $
* $Id: demux.c,v 1.3 2002/10/23 21:54:33 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -475,11 +475,13 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_lock( &p_input->stream.stream_lock );
if( input_InitStream( p_input, 0 ) == -1)
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot init stream" );
return( -1 );
}
if( input_AddProgram( p_input, 0, 0) == NULL )
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot add program" );
return( -1 );
}
......
......@@ -2,7 +2,7 @@
* audio.c : mpeg audio Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: audio.c,v 1.8 2002/08/24 21:35:31 sigmunau Exp $
* $Id: audio.c,v 1.9 2002/10/23 21:54:33 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -513,6 +513,7 @@ static int Activate( vlc_object_t * p_this )
/* check if it could be a ps stream */
if( !b_forced && CheckPS( p_input ))
{
free( p_input->p_demux_data );
return( -1 );
}
......@@ -532,6 +533,7 @@ static int Activate( vlc_object_t * p_this )
else
{
msg_Warn( p_input, "MPEGAudio module discarded (no frame found)" );
free( p_input->p_demux_data );
return( -1 );
}
}
......@@ -545,11 +547,13 @@ static int Activate( vlc_object_t * p_this )
if( input_InitStream( p_input, 0 ) == -1)
{
msg_Err( p_input, "cannot init stream" );
free( p_input->p_demux_data );
return( -1 );
}
if( input_AddProgram( p_input, 0, 0) == NULL )
{
msg_Err( p_input, "cannot add program" );
free( p_input->p_demux_data );
return( -1 );
}
p_input->stream.pp_programs[0]->b_is_ok = 0;
......@@ -564,6 +568,7 @@ static int Activate( vlc_object_t * p_this )
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "out of memory" );
free( p_input->p_demux_data );
return( -1 );
}
p_demux->p_es->i_stream_id = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment