Module: wine Branch: master Commit: afb17f29e17b8b2cd6e62b8bf0d2ae02166db573 URL: http://source.winehq.org/git/wine.git/?a=commit;h=afb17f29e17b8b2cd6e62b8bf0...
Author: Michael Karcher wine@mkarcher.dialup.fu-berlin.de Date: Sat Nov 29 10:52:24 2008 +0100
msxml3: attach_xmldoc may fail.
The upcoming new implementation of attach_xmldoc needs HeapAlloc. Prepare for the failure case.
---
dlls/msxml3/domdoc.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index c8eec39..f71b134 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -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; }