From 775254b88b5e8fc2ebee6f375c2da4d8af1b7e7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Fri, 15 Aug 2008 09:26:33 +0200 Subject: [PATCH] Fix potential memleak. --- modules/demux/playlist/b4s.c | 7 ++++++- modules/demux/playlist/podcast.c | 7 ++++++- modules/gui/skins2/parser/xmlparser.cpp | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c index 8431a06fd2..629137fde4 100644 --- a/modules/demux/playlist/b4s.c +++ b/modules/demux/playlist/b4s.c @@ -149,7 +149,12 @@ static int Demux( demux_t *p_demux ) { char *psz_name = xml_ReaderName( p_xml_reader ); char *psz_value = xml_ReaderValue( p_xml_reader ); - if( !psz_name || !psz_value ) return -1; + if( !psz_name || !psz_value ) + { + free( psz_name ); + free( psz_value ); + return -1; + } if( !strcmp( psz_name, "num_entries" ) ) { msg_Dbg( p_demux, "playlist has %d entries", atoi(psz_value) ); diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c index 20f8754fec..c507cddc7e 100644 --- a/modules/demux/playlist/podcast.c +++ b/modules/demux/playlist/podcast.c @@ -168,7 +168,12 @@ static int Demux( demux_t *p_demux ) { char *psz_name = xml_ReaderName( p_xml_reader ); char *psz_value = xml_ReaderValue( p_xml_reader ); - if( !psz_name || !psz_value ) return -1; + if( !psz_name || !psz_value ) + { + free( psz_name ); + free( psz_value ); + return -1; + } if( !strcmp( psz_elname, "enclosure" ) && !strcmp( psz_name, "url" ) ) { diff --git a/modules/gui/skins2/parser/xmlparser.cpp b/modules/gui/skins2/parser/xmlparser.cpp index 2e66d04ce9..793affb264 100644 --- a/modules/gui/skins2/parser/xmlparser.cpp +++ b/modules/gui/skins2/parser/xmlparser.cpp @@ -163,7 +163,12 @@ bool XMLParser::parse() { char *name = xml_ReaderName( m_pReader ); char *value = xml_ReaderValue( m_pReader ); - if( !name || !value ) return false; + if( !name || !value ) + { + free( name ); + free( value ); + return false; + } attributes[name] = value; } -- 2.39.5