[vlc-commits] commit: Fixed a segfault and a possible memory leak in xml_reader_t API ( Laurent Aimar )
git at videolan.org
git at videolan.org
Tue Aug 17 23:38:06 CEST 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Aug 17 23:24:26 2010 +0200| [45991a807b72af682a854b323407d7fd10e518cf] | committer: Laurent Aimar
Fixed a segfault and a possible memory leak in xml_reader_t API
xml_ReaderReset(reader, NULL) followed by xml_ReaderDelete(reader) lead
to a double free.
xml_ReaderReset(reader, stream) would leak the module upon error.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45991a807b72af682a854b323407d7fd10e518cf
---
src/misc/xml.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/misc/xml.c b/src/misc/xml.c
index 6e23522..1748bfc 100644
--- a/src/misc/xml.c
+++ b/src/misc/xml.c
@@ -98,7 +98,9 @@ xml_reader_t *xml_ReaderCreate(vlc_object_t *obj, stream_t *stream)
*/
void xml_ReaderDelete(xml_reader_t *reader)
{
- module_unneed(reader, reader->p_module);
+ if (reader->p_stream)
+ module_stop(reader, reader->p_module);
+ module_release(reader->p_module);
vlc_object_release(reader);
}
@@ -123,6 +125,7 @@ xml_reader_t *xml_ReaderReset(xml_reader_t *reader, stream_t *stream)
reader->p_stream = stream;
if ((stream != NULL) && module_start(reader, reader->p_module))
{
+ module_release(reader->p_module);
vlc_object_release(reader);
return NULL;
}
More information about the vlc-commits
mailing list