From: Thadeu Lima de Souza Cascardo Date: Sat, 9 Aug 2008 20:28:16 +0000 (-0300) Subject: libxml2 may return document with null root node X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fatompub.git;a=commitdiff_plain;h=4acb52c0adc80618acebaed53d258a2ffc60057d libxml2 may return document with null root node --- diff --git a/atom/entry.c b/atom/entry.c index c78a916..d366500 100644 --- a/atom/entry.c +++ b/atom/entry.c @@ -55,12 +55,12 @@ atom_entry_new_data_len (char *data, size_t len) xmlNodePtr child; entry = g_slice_new0 (AtomEntry); entry->doc = xmlReadMemory (data, len, NULL, NULL, XML_PARSE_RECOVER); - if (entry->doc == NULL) + if (entry->doc == NULL || + (root = xmlDocGetRootElement (entry->doc)) == NULL) { g_slice_free (AtomEntry, entry); return NULL; } - root = xmlDocGetRootElement (entry->doc); if (xmlStrcmp (root->name, "entry")) { xmlFreeDoc (entry->doc);