Commit fcce5018 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix a segmentation fault in case of error

parent efaf656a
...@@ -165,7 +165,6 @@ static void CatalogAdd( xml_t *p_xml, const char *psz_arg1, ...@@ -165,7 +165,6 @@ static void CatalogAdd( xml_t *p_xml, const char *psz_arg1,
static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s )
{ {
xml_reader_t *p_reader; xml_reader_t *p_reader;
xml_reader_sys_t *p_sys;
char *p_buffer; char *p_buffer;
int i_size,i_buffer; int i_size,i_buffer;
XTag *p_root; XTag *p_root;
...@@ -174,6 +173,9 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) ...@@ -174,6 +173,9 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s )
i_size = stream_Size( s ) - stream_Tell( s ); i_size = stream_Size( s ) - stream_Tell( s );
p_buffer = malloc( i_size + 1 ); p_buffer = malloc( i_size + 1 );
if( p_buffer == NULL )
return NULL;
i_buffer = 0; i_buffer = 0;
while( i_buffer < i_size ) while( i_buffer < i_size )
{ {
...@@ -198,7 +200,7 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) ...@@ -198,7 +200,7 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s )
} }
p_reader = malloc( sizeof(xml_reader_t) ); p_reader = malloc( sizeof(xml_reader_t) );
p_reader->p_sys = p_sys = malloc( sizeof(xml_reader_sys_t) ); p_reader->p_sys = malloc( sizeof(xml_reader_sys_t) );
p_reader->p_sys->p_root = p_root; p_reader->p_sys->p_root = p_root;
p_reader->p_sys->p_curtag = NULL; p_reader->p_sys->p_curtag = NULL;
p_reader->p_sys->p_curattr = NULL; p_reader->p_sys->p_curattr = NULL;
......
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