aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmltree.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2012-09-25 01:10:05 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2012-09-25 01:10:05 +0100
commitba8671363c6d3dfbaf54029f35b3455c46cbc7d1 (patch)
tree5cb6a5ac8cd447974a3090c212caeb63e1fd6d0f /lib/xmltree.c
parent6bef2110ddeb9e1f8e8233a4e61b8917fb939b29 (diff)
parent2a6da96544675726c73a60b588dc26e477ce70f5 (diff)
More mainline merges.
Diffstat (limited to 'lib/xmltree.c')
-rw-r--r--lib/xmltree.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/xmltree.c b/lib/xmltree.c
index 91d256d2..3ecb2b93 100644
--- a/lib/xmltree.c
+++ b/lib/xmltree.c
@@ -265,15 +265,18 @@ void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth )
struct xt_node *xt_from_string( const char *in, int len )
{
struct xt_parser *parser;
- struct xt_node *ret;
+ struct xt_node *ret = NULL;
if( len == 0 )
len = strlen( in );
parser = xt_new( NULL, NULL );
xt_feed( parser, in, len );
- ret = parser->root;
- parser->root = NULL;
+ if( parser->cur == NULL )
+ {
+ ret = parser->root;
+ parser->root = NULL;
+ }
xt_free( parser );
return ret;