Commit afb17f29 authored by Michael Karcher's avatar Michael Karcher Committed by Alexandre Julliard

msxml3: attach_xmldoc may fail.

The upcoming new implementation of attach_xmldoc needs HeapAlloc. Prepare for the failure case.
parent 8b293040
......@@ -209,7 +209,7 @@ HRESULT xmldoc_remove_orphan(xmlDocPtr doc, xmlNodePtr node)
return S_FALSE;
}
static void attach_xmldoc( IXMLDOMNode *node, xmlDocPtr xml )
static HRESULT attach_xmldoc( IXMLDOMNode *node, xmlDocPtr xml )
{
xmlnode *This = impl_from_IXMLDOMNode( node );
......@@ -220,7 +220,7 @@ static void attach_xmldoc( IXMLDOMNode *node, xmlDocPtr xml )
if(This->node)
xmldoc_add_ref(This->node->doc);
return;
return S_OK;
}
static inline domdoc *impl_from_IXMLDOMDocument2( IXMLDOMDocument2 *iface )
......@@ -345,9 +345,8 @@ static HRESULT WINAPI xmldoc_IPersistStream_Load(
}
xmldoc->_private = create_priv();
attach_xmldoc( This->node, xmldoc );
return S_OK;
return attach_xmldoc( This->node, xmldoc );
}
static HRESULT WINAPI xmldoc_IPersistStream_Save(
......@@ -1324,7 +1323,7 @@ static HRESULT domdoc_onDataAvailable(void *obj, char *ptr, DWORD len)
xmldoc = doparse( ptr, len );
if(xmldoc) {
xmldoc->_private = create_priv();
attach_xmldoc(This->node, xmldoc);
return attach_xmldoc(This->node, xmldoc);
}
return S_OK;
......@@ -1377,11 +1376,12 @@ static HRESULT WINAPI domdoc_load(
{
domdoc *newDoc = impl_from_IXMLDOMDocument2( pNewDoc );
xmldoc = xmlCopyDoc(get_doc(newDoc), 1);
attach_xmldoc(This->node, xmldoc);
hr = attach_xmldoc(This->node, xmldoc);
*isSuccessful = VARIANT_TRUE;
if(SUCCEEDED(hr))
*isSuccessful = VARIANT_TRUE;
return S_OK;
return hr;
}
}
hr = IUnknown_QueryInterface(V_UNKNOWN(&xmlSource), &IID_IStream, (void**)&pStream);
......@@ -1438,8 +1438,9 @@ static HRESULT WINAPI domdoc_load(
if(!filename || FAILED(hr)) {
xmldoc = xmlNewDoc(NULL);
xmldoc->_private = create_priv();
attach_xmldoc(This->node, xmldoc);
hr = S_FALSE;
hr = attach_xmldoc(This->node, xmldoc);
if(SUCCEEDED(hr))
hr = S_FALSE;
}
TRACE("ret (%d)\n", hr);
......@@ -1541,7 +1542,7 @@ static HRESULT WINAPI domdoc_loadXML(
xmlDocPtr xmldoc = NULL;
char *str;
int len;
HRESULT hr = S_FALSE;
HRESULT hr = S_FALSE, hr2;
TRACE("%p %s %p\n", This, debugstr_w( bstrXML ), isSuccessful );
......@@ -1568,7 +1569,9 @@ static HRESULT WINAPI domdoc_loadXML(
xmldoc = xmlNewDoc(NULL);
xmldoc->_private = create_priv();
attach_xmldoc( This->node, xmldoc );
hr2 = attach_xmldoc( This->node, xmldoc );
if( FAILED(hr2) )
hr = hr2;
return hr;
}
......
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