[vlc-devel] commit: Check malloc return value. ( Rémi Duraffort )
git version control
git at videolan.org
Fri Aug 15 21:54:40 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Aug 15 08:55:50 2008 +0200| [6a0fc8156ba5a67afcffe79c4ba688695e12a8d9] | committer: Rémi Duraffort
Check malloc return value.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a0fc8156ba5a67afcffe79c4ba688695e12a8d9
---
modules/misc/xml/libxml.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/modules/misc/xml/libxml.c b/modules/misc/xml/libxml.c
index c098f68..14f868a 100644
--- a/modules/misc/xml/libxml.c
+++ b/modules/misc/xml/libxml.c
@@ -134,11 +134,22 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *p_stream )
if( !p_libxml_reader )
{
msg_Err( p_xml, "failed to create XML parser" );
- return 0;
+ return NULL;
}
p_reader = malloc( sizeof(xml_reader_t) );
+ if( !p_reader )
+ {
+ xmlFreeTextReader( p_reader->p_sys->p_reader );
+ return NULL;
+ }
p_reader->p_sys = p_sys = malloc( sizeof(xml_reader_sys_t) );
+ if( !p_sys )
+ {
+ free( p_reader );
+ xmlFreeTextReader( p_reader->p_sys->p_reader );
+ return NULL;
+ }
p_reader->p_sys->p_reader = p_libxml_reader;
p_reader->p_xml = p_xml;
More information about the vlc-devel
mailing list