Index: src/axl_doc.c =================================================================== --- src/axl_doc.c (revision 3355) +++ src/axl_doc.c (working copy) @@ -1077,12 +1077,12 @@ * decoder (only if defined handler found) */ if (detect_codification_func) { if (! detect_codification_func (stream, &doc->detected_encoding, detect_codification_data, error)) - return NULL; + goto fail; } /* end if */ /* parse initial xml header */ if (!__axl_doc_parse_xml_header (stream, doc, error)) - return NULL; + goto fail; /* signal that this document have processed its header */ doc->headerProcess = true; @@ -1090,7 +1090,7 @@ /* parse the rest of the document, setting as parent NULL * because still no parent is found. */ if (!__axl_doc_parse_node (stream, doc, &node, &is_empty, error)) - return NULL; + goto fail; /* if the node returned is not empty */ if (! is_empty) { @@ -1115,7 +1115,7 @@ /* consume a possible comment and process instructions */ if (axl_stream_peek (stream, " 0 || axl_stream_peek (stream, "