Commit 318e9b86 authored by gbazin's avatar gbazin

* Fixed a bunch of memory leaks.

parent 3595258c
......@@ -957,8 +957,11 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
p_avcC = p_box->data.p_avcC;
p_avcC->i_avcC = i_read;
p_avcC->p_avcC = malloc( p_avcC->i_avcC );
memcpy( p_avcC->p_avcC, p_peek, i_read );
if( p_avcC->i_avcC > 0 )
{
p_avcC->p_avcC = malloc( p_avcC->i_avcC );
memcpy( p_avcC->p_avcC, p_peek, i_read );
}
MP4_GET1BYTE( p_avcC->i_version );
MP4_GET1BYTE( p_avcC->i_profile );
......@@ -1030,6 +1033,8 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC;
int i;
if( p_avcC->i_avcC > 0 ) FREENULL( p_avcC->p_avcC );
for( i = 0; i < p_avcC->i_sps; i++ )
{
FREENULL( p_avcC->sps[i] );
......@@ -1039,7 +1044,9 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
FREENULL( p_avcC->pps[i] );
}
if( p_avcC->i_sps > 0 ) FREENULL( p_avcC->sps );
if( p_avcC->i_sps > 0 ) FREENULL( p_avcC->i_sps_length );
if( p_avcC->i_pps > 0 ) FREENULL( p_avcC->pps );
if( p_avcC->i_pps > 0 ) FREENULL( p_avcC->i_pps_length );
}
static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
......
......@@ -85,7 +85,7 @@ vlc_module_begin();
set_description( _("XSPF playlist import") );
add_shortcut( "xspf-open" );
set_capability( "demux2", 10 );
set_callbacks( E_(xspf_import_Activate), NULL );
set_callbacks( E_(Import_xspf),E_(Close_xspf) );
add_submodule();
set_description( _("New winamp 5.2 shoutcast import") );
add_shortcut( "shout-winamp" );
......
......@@ -48,7 +48,8 @@ void E_(Close_DVB) ( vlc_object_t * );
int E_(Import_podcast) ( vlc_object_t * );
void E_(Close_podcast) ( vlc_object_t * );
int E_(xspf_import_Activate) ( vlc_object_t * );
int E_(Import_xspf) ( vlc_object_t * );
void E_(Close_xspf) ( vlc_object_t * );
int E_(Import_Shoutcast) ( vlc_object_t * );
void E_(Close_Shoutcast) ( vlc_object_t * );
......
......@@ -51,13 +51,19 @@ static int Demux( demux_t * );
/**
* \brief XSPF submodule initialization function
*/
int E_(xspf_import_Activate)( vlc_object_t *p_this )
int E_(Import_xspf)( vlc_object_t *p_this )
{
DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".xspf", "xspf-open",
"using XSPF playlist reader" );
return VLC_SUCCESS;
}
void E_(Close_xspf)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
free( p_demux->p_sys );
}
/**
* \brief demuxer function for XSPF parsing
*/
......
......@@ -120,9 +120,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *p_stream )
xml_reader_t *p_reader;
xml_reader_sys_t *p_sys;
xmlTextReaderPtr p_libxml_reader;
xmlParserInputBufferPtr p_read_context;
p_read_context = malloc( sizeof( xmlParserInputBuffer ) );
p_libxml_reader = xmlReaderForIO( StreamRead, NULL, p_stream,
NULL, NULL, 0 );
......@@ -216,7 +213,7 @@ static char *ReaderName( xml_reader_t *p_reader )
const xmlChar *psz_name =
xmlTextReaderConstName( p_reader->p_sys->p_reader );
if( psz_name ) return strdup( psz_name );
if( psz_name ) return strdup( (const char *)psz_name );
else return 0;
}
......@@ -225,7 +222,7 @@ static char *ReaderValue( xml_reader_t *p_reader )
const xmlChar *psz_value =
xmlTextReaderConstValue( p_reader->p_sys->p_reader );
if( psz_value ) return strdup( psz_value );
if( psz_value ) return strdup( (const char *)psz_value );
else return 0;
}
......
......@@ -1970,8 +1970,8 @@ static int InputSourceInit( input_thread_t *p_input,
{
psz_path = psz_mrl;
msg_Dbg( p_input, "trying to pre-parse %s", psz_path );
psz_demux = strdup( "" );
psz_access = strdup( "file" );
psz_demux = "";
psz_access = "file";
}
if( in->p_demux )
......
......@@ -98,7 +98,6 @@ spu_t *__spu_Create( vlc_object_t *p_this )
*/
int spu_Init( spu_t *p_spu )
{
char *psz_filter;
char *psz_parser;
vlc_value_t val;
......@@ -110,8 +109,7 @@ int spu_Init( spu_t *p_spu )
var_Create( p_spu, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_spu, "sub-filter", &val );
psz_filter = val.psz_string;
psz_parser = psz_filter;
psz_parser = val.psz_string;
while( psz_parser && *psz_parser )
{
......@@ -153,6 +151,7 @@ int spu_Init( spu_t *p_spu )
free( psz_name );
}
if( val.psz_string ) free( val.psz_string );
return VLC_EGENERIC;
}
......
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