Commit aa340922 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Backport of rev 16972 (fixed bunch of memory leaks)

parent 973ed38c
...@@ -958,8 +958,11 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -958,8 +958,11 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
p_avcC = p_box->data.p_avcC; p_avcC = p_box->data.p_avcC;
p_avcC->i_avcC = i_read; p_avcC->i_avcC = i_read;
p_avcC->p_avcC = malloc( p_avcC->i_avcC ); if( p_avcC->i_avcC > 0 )
memcpy( p_avcC->p_avcC, p_peek, i_read ); {
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_version );
MP4_GET1BYTE( p_avcC->i_profile ); MP4_GET1BYTE( p_avcC->i_profile );
...@@ -1031,6 +1034,12 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box ) ...@@ -1031,6 +1034,12 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC; MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC;
int i; int i;
if( p_avcC->i_avcC > 0 )
{
if( p_avcC->p_avcC )
free( p_avcC->p_avcC );
p_avcC->p_avcC = NULL;
}
for( i = 0; i < p_avcC->i_sps; i++ ) for( i = 0; i < p_avcC->i_sps; i++ )
{ {
FREE( p_avcC->sps[i] ); FREE( p_avcC->sps[i] );
...@@ -1039,8 +1048,20 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box ) ...@@ -1039,8 +1048,20 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
{ {
FREE( p_avcC->pps[i] ); FREE( p_avcC->pps[i] );
} }
if( p_avcC->i_sps > 0 ) FREE( p_avcC->sps ); if( p_avcC->i_sps > 0 )
if( p_avcC->i_pps > 0 ) FREE( p_avcC->pps ); {
FREE( p_avcC->sps );
p_avcC->sps = NULL;
FREE( p_avcC->i_sps_length );
p_avcC->i_sps_length = NULL;
}
if( p_avcC->i_pps > 0 )
{
FREE( p_avcC->pps );
p_avcC->pps = NULL;
FREE( p_avcC->i_pps_length );
p_avcC->i_pps_length = NULL;
}
} }
static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
......
...@@ -61,6 +61,12 @@ int E_(Import_Old)( vlc_object_t *p_this ) ...@@ -61,6 +61,12 @@ int E_(Import_Old)( vlc_object_t *p_this )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
void E_(Close_Old)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
msg_Dbg( p_demux, "close old playlist file" );
}
static int Demux( demux_t *p_demux) static int Demux( demux_t *p_demux)
{ {
char *psz_line; char *psz_line;
......
...@@ -54,7 +54,7 @@ vlc_module_begin(); ...@@ -54,7 +54,7 @@ vlc_module_begin();
set_description( _("Playlist") ); set_description( _("Playlist") );
add_shortcut( "old-open" ); add_shortcut( "old-open" );
set_capability( "demux2", 10 ); set_capability( "demux2", 10 );
set_callbacks( E_(Import_Old), NULL ); set_callbacks( E_(Import_Old), E_(Close_Old) );
#if 0 #if 0
add_submodule(); add_submodule();
set_description( _("Native playlist import") ); set_description( _("Native playlist import") );
...@@ -93,7 +93,7 @@ vlc_module_begin(); ...@@ -93,7 +93,7 @@ vlc_module_begin();
set_description( _("XSPF playlist import") ); set_description( _("XSPF playlist import") );
add_shortcut( "xspf-open" ); add_shortcut( "xspf-open" );
set_capability( "demux2", 10 ); set_capability( "demux2", 10 );
set_callbacks( E_(xspf_import_Activate), NULL ); set_callbacks( E_(Import_xspf), E_(Close_xspf) );
add_submodule(); add_submodule();
set_description( _("New winamp 5.2 shoutcast import") ); set_description( _("New winamp 5.2 shoutcast import") );
add_shortcut( "shout-winamp" ); add_shortcut( "shout-winamp" );
......
...@@ -27,6 +27,7 @@ char *E_(FindPrefix)( demux_t * ); ...@@ -27,6 +27,7 @@ char *E_(FindPrefix)( demux_t * );
vlc_bool_t E_(FindItem)( demux_t *, playlist_t *, playlist_item_t **); vlc_bool_t E_(FindItem)( demux_t *, playlist_t *, playlist_item_t **);
int E_(Import_Old) ( vlc_object_t * ); int E_(Import_Old) ( vlc_object_t * );
void E_(Close_Old) ( vlc_object_t *);
int E_(Import_Native) ( vlc_object_t * ); int E_(Import_Native) ( vlc_object_t * );
void E_(Close_Native) ( vlc_object_t * ); void E_(Close_Native) ( vlc_object_t * );
...@@ -46,7 +47,8 @@ void E_(Close_DVB) ( vlc_object_t * ); ...@@ -46,7 +47,8 @@ void E_(Close_DVB) ( vlc_object_t * );
int E_(Import_podcast) ( vlc_object_t * ); int E_(Import_podcast) ( vlc_object_t * );
void E_(Close_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 * ); int E_(Import_Shoutcast) ( vlc_object_t * );
void E_(Close_Shoutcast) ( vlc_object_t * ); void E_(Close_Shoutcast) ( vlc_object_t * );
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/** /**
* \brief XSPF submodule initialization function * \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_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
char *psz_ext; char *psz_ext;
...@@ -57,6 +57,12 @@ int E_(xspf_import_Activate)( vlc_object_t *p_this ) ...@@ -57,6 +57,12 @@ int E_(xspf_import_Activate)( vlc_object_t *p_this )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
void E_(Close_xpsf)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
msg_Dbg( p_demux, "closing xspf playlist" );
}
/** /**
* \brief demuxer function for XSPF parsing * \brief demuxer function for XSPF parsing
*/ */
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*******************************************************************************/ *******************************************************************************/
#ifndef _XSPF_H_
#define _XSPF_H_ 1
/** /**
* \file modules/demux/playlist/xspf.h * \file modules/demux/playlist/xspf.h
* \brief XSPF playlist import: prototypes, datatypes, defines * \brief XSPF playlist import: prototypes, datatypes, defines
...@@ -60,3 +63,5 @@ typedef struct ...@@ -60,3 +63,5 @@ typedef struct
vlc_bool_t (*cmplx) COMPLEX_INTERFACE; vlc_bool_t (*cmplx) COMPLEX_INTERFACE;
} pf_handler; } pf_handler;
} xml_elem_hnd_t; } xml_elem_hnd_t;
#endif /* _XSPF_H_ */
...@@ -1307,12 +1307,12 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, ...@@ -1307,12 +1307,12 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y,
/* Put the items in the playlist node */ /* Put the items in the playlist node */
for( size_t i = 0; i < filenames.GetCount(); i++ ) for( size_t i = 0; i < filenames.GetCount(); i++ )
{ {
const char *psz_utf8 = wxDnDFromLocale( filenames[i] ); char *psz_utf8 = wxDnDFromLocale( filenames[i] );
playlist_item_t *p_item = playlist_item_t *p_item =
playlist_ItemNew( p->p_playlist, psz_utf8, psz_utf8 ); playlist_ItemNew( p->p_playlist, psz_utf8, psz_utf8 );
playlist_NodeAddItem( p->p_playlist, p_item, p->i_current_view, playlist_NodeAddItem( p->p_playlist, p_item, p->i_current_view,
p_dest, PLAYLIST_PREPARSE, i_pos ); p_dest, PLAYLIST_PREPARSE, i_pos );
wxDnDLocaleFree( (char*)psz_utf8 ); wxDnDLocaleFree( psz_utf8 );
} }
/* FIXME: having this Rebuild() is dirty */ /* FIXME: having this Rebuild() is dirty */
......
...@@ -120,9 +120,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *p_stream ) ...@@ -120,9 +120,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *p_stream )
xml_reader_t *p_reader; xml_reader_t *p_reader;
xml_reader_sys_t *p_sys; xml_reader_sys_t *p_sys;
xmlTextReaderPtr p_libxml_reader; xmlTextReaderPtr p_libxml_reader;
xmlParserInputBufferPtr p_read_context;
p_read_context = malloc( sizeof( xmlParserInputBuffer ) );
p_libxml_reader = xmlReaderForIO( StreamRead, NULL, p_stream, p_libxml_reader = xmlReaderForIO( StreamRead, NULL, p_stream,
NULL, NULL, 0 ); NULL, NULL, 0 );
...@@ -216,7 +213,7 @@ static char *ReaderName( xml_reader_t *p_reader ) ...@@ -216,7 +213,7 @@ static char *ReaderName( xml_reader_t *p_reader )
const xmlChar *psz_name = const xmlChar *psz_name =
xmlTextReaderConstName( p_reader->p_sys->p_reader ); 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; else return 0;
} }
...@@ -225,7 +222,7 @@ static char *ReaderValue( xml_reader_t *p_reader ) ...@@ -225,7 +222,7 @@ static char *ReaderValue( xml_reader_t *p_reader )
const xmlChar *psz_value = const xmlChar *psz_value =
xmlTextReaderConstValue( p_reader->p_sys->p_reader ); 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; else return 0;
} }
......
...@@ -2041,8 +2041,8 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2041,8 +2041,8 @@ static int InputSourceInit( input_thread_t *p_input,
{ {
psz_path = psz_mrl; psz_path = psz_mrl;
msg_Dbg( p_input, "trying to pre-parse %s", psz_path ); msg_Dbg( p_input, "trying to pre-parse %s", psz_path );
psz_demux = strdup( "" ); psz_demux = "";
psz_access = strdup( "file" ); psz_access = "file";
} }
if( in->p_demux ) if( in->p_demux )
......
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