[vlc-commits] xspf demux: fix memleak
Rafaël Carré
git at videolan.org
Mon Aug 8 01:58:29 CEST 2011
vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Sun Aug 7 19:22:24 2011 -0400| [e392d6ff398ab91a6d6a7ea29e2d8fecf8322828] | committer: Rafaël Carré
xspf demux: fix memleak
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e392d6ff398ab91a6d6a7ea29e2d8fecf8322828
---
modules/demux/playlist/xspf.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 0563f0b..1ebbdaa 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -65,10 +65,8 @@ void Close_xspf(vlc_object_t *p_this)
demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
for (int i = 0; i < p_sys->i_tracklist_entries; i++)
- {
if (p_sys->pp_tracklist[i])
vlc_gc_decref(p_sys->pp_tracklist[i]);
- }
free(p_sys->pp_tracklist);
free(p_sys->psz_base);
free(p_sys);
@@ -323,7 +321,6 @@ static bool parse_track_node COMPLEX_INTERFACE
const xml_elem_hnd_t *p_handler = NULL;
demux_sys_t *p_sys = p_demux->p_sys;
int i_node;
- bool b_ret = false;
static const xml_elem_hnd_t track_elements[] =
{ {"location", SIMPLE_CONTENT, {NULL} },
@@ -375,8 +372,10 @@ static bool parse_track_node COMPLEX_INTERFACE
FREE_VALUE();
if (!p_handler->pf_handler.cmplx(p_demux, p_new_node,
- p_xml_reader, p_handler->name))
+ p_xml_reader, p_handler->name)) {
+ input_item_node_Delete(p_new_node);
return false;
+ }
p_handler = NULL;
}
@@ -420,6 +419,7 @@ static bool parse_track_node COMPLEX_INTERFACE
if (!pp)
{
vlc_gc_decref(p_new_input);
+ input_item_node_Delete(p_new_node);
return false;
}
p_sys->pp_tracklist = pp;
@@ -430,10 +430,12 @@ static bool parse_track_node COMPLEX_INTERFACE
{
msg_Err(p_demux, "track ID %d collision", p_sys->i_track_id);
vlc_gc_decref(p_new_input);
+ input_item_node_Delete(p_new_node);
return false;
}
p_sys->pp_tracklist[ p_sys->i_track_id ] = p_new_input;
+ input_item_node_Delete(p_new_node);
return true;
}
/* there MUST have been a start tag for that element name */
@@ -489,8 +491,10 @@ static bool parse_track_node COMPLEX_INTERFACE
msg_Err(p_demux, "unexpected end of xml data");
end:
+
+ input_item_node_Delete(p_new_node);
free(psz_value);
- return b_ret;
+ return false;
}
/**
More information about the vlc-commits
mailing list