[PATCH 1/3] Always set out pointer to null on failed QueryInterface

Nikolay Sivov nsivov at codeweavers.com
Mon Feb 28 13:28:53 CST 2011


---
 dlls/msxml3/attribute.c  |    1 +
 dlls/msxml3/bsc.c        |    1 +
 dlls/msxml3/cdata.c      |    7 +------
 dlls/msxml3/comment.c    |    1 +
 dlls/msxml3/docfrag.c    |    1 +
 dlls/msxml3/doctype.c    |    1 +
 dlls/msxml3/domimpl.c    |    1 +
 dlls/msxml3/element.c    |    1 +
 dlls/msxml3/entityref.c  |    1 +
 dlls/msxml3/factory.c    |    1 +
 dlls/msxml3/nodemap.c    |    1 +
 dlls/msxml3/parseerror.c |    1 +
 dlls/msxml3/pi.c         |    1 +
 dlls/msxml3/schema.c     |    1 +
 dlls/msxml3/stylesheet.c |    1 +
 dlls/msxml3/text.c       |    8 +-------
 dlls/msxml3/xmldoc.c     |    1 +
 dlls/msxml3/xmlelem.c    |    1 +
 18 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c
index 60af5a4..170f632 100644
--- a/dlls/msxml3/attribute.c
+++ b/dlls/msxml3/attribute.c
@@ -77,6 +77,7 @@ static HRESULT WINAPI domattr_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/bsc.c b/dlls/msxml3/bsc.c
index b57e2b1..9a8be97 100644
--- a/dlls/msxml3/bsc.c
+++ b/dlls/msxml3/bsc.c
@@ -74,6 +74,7 @@ static HRESULT WINAPI bsc_QueryInterface(
     }
 
     TRACE("interface %s not implemented\n", debugstr_guid(riid));
+    *ppobj = NULL;
     return E_NOINTERFACE;
 }
 
diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c
index 16c2df2..cdcebb0 100644
--- a/dlls/msxml3/cdata.c
+++ b/dlls/msxml3/cdata.c
@@ -70,12 +70,6 @@ static HRESULT WINAPI domcdata_QueryInterface(
     {
         *ppvObject = iface;
     }
-    else if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
-              IsEqualGUID( riid, &IID_IXMLDOMElement ) )
-    {
-        TRACE("Unsupported interface\n");
-        return E_NOINTERFACE;
-    }
     else if(node_query_interface(&This->node, riid, ppvObject))
     {
         return *ppvObject ? S_OK : E_NOINTERFACE;
@@ -83,6 +77,7 @@ static HRESULT WINAPI domcdata_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index 435c4af..433cca9 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -77,6 +77,7 @@ static HRESULT WINAPI domcomment_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c
index 5862b6f..89b82a9 100644
--- a/dlls/msxml3/docfrag.c
+++ b/dlls/msxml3/docfrag.c
@@ -76,6 +76,7 @@ static HRESULT WINAPI domfrag_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/doctype.c b/dlls/msxml3/doctype.c
index ff939fc..9ebe1f0 100644
--- a/dlls/msxml3/doctype.c
+++ b/dlls/msxml3/doctype.c
@@ -78,6 +78,7 @@ static HRESULT WINAPI domdoctype_QueryInterface(
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/domimpl.c b/dlls/msxml3/domimpl.c
index 2e35d98..54936bb 100644
--- a/dlls/msxml3/domimpl.c
+++ b/dlls/msxml3/domimpl.c
@@ -70,6 +70,7 @@ static HRESULT WINAPI dimimpl_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index 9573de9..b1de8df 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -86,6 +86,7 @@ static HRESULT WINAPI domelem_QueryInterface(
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c
index 1c3bd7d..add4d8a 100644
--- a/dlls/msxml3/entityref.c
+++ b/dlls/msxml3/entityref.c
@@ -76,6 +76,7 @@ static HRESULT WINAPI entityref_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/factory.c b/dlls/msxml3/factory.c
index 5cce95b..027506c 100644
--- a/dlls/msxml3/factory.c
+++ b/dlls/msxml3/factory.c
@@ -80,6 +80,7 @@ static HRESULT WINAPI ClassFactory_QueryInterface(
     }
 
     FIXME("interface %s not implemented\n", debugstr_guid(riid));
+    *ppobj = NULL;
     return E_NOINTERFACE;
 }
 
diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c
index b05192b..6df1028 100644
--- a/dlls/msxml3/nodemap.c
+++ b/dlls/msxml3/nodemap.c
@@ -82,6 +82,7 @@ static HRESULT WINAPI xmlnodemap_QueryInterface(
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/parseerror.c b/dlls/msxml3/parseerror.c
index a3f400a..3f5c59f 100644
--- a/dlls/msxml3/parseerror.c
+++ b/dlls/msxml3/parseerror.c
@@ -71,6 +71,7 @@ static HRESULT WINAPI parseError_QueryInterface(
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c
index 6c5361a..335b584 100644
--- a/dlls/msxml3/pi.c
+++ b/dlls/msxml3/pi.c
@@ -76,6 +76,7 @@ static HRESULT WINAPI dom_pi_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c
index e43aeb4..e2bf8b3 100644
--- a/dlls/msxml3/schema.c
+++ b/dlls/msxml3/schema.c
@@ -948,6 +948,7 @@ static HRESULT WINAPI schema_cache_QueryInterface(IXMLDOMSchemaCollection2* ifac
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/stylesheet.c b/dlls/msxml3/stylesheet.c
index 5bde047..00ba3ca 100644
--- a/dlls/msxml3/stylesheet.c
+++ b/dlls/msxml3/stylesheet.c
@@ -96,6 +96,7 @@ static HRESULT WINAPI xsltemplate_QueryInterface(
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c
index 8036d32..b17d1d4 100644
--- a/dlls/msxml3/text.c
+++ b/dlls/msxml3/text.c
@@ -75,16 +75,10 @@ static HRESULT WINAPI domtext_QueryInterface(
     {
         return *ppvObject ? S_OK : E_NOINTERFACE;
     }
-    else if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
-              IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) )
-    {
-        /* IXMLDOMText is known to be correct in not implementing these */
-        TRACE("Unsupported interface\n");
-        return E_NOINTERFACE;
-    }
     else
     {
         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/xmldoc.c b/dlls/msxml3/xmldoc.c
index b833ba2..a9d1dd8 100644
--- a/dlls/msxml3/xmldoc.c
+++ b/dlls/msxml3/xmldoc.c
@@ -95,6 +95,7 @@ static HRESULT WINAPI xmldoc_QueryInterface(IXMLDocument *iface, REFIID riid, vo
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
diff --git a/dlls/msxml3/xmlelem.c b/dlls/msxml3/xmlelem.c
index 19e8194..9e08cc2 100644
--- a/dlls/msxml3/xmlelem.c
+++ b/dlls/msxml3/xmlelem.c
@@ -75,6 +75,7 @@ static HRESULT WINAPI xmlelem_QueryInterface(IXMLElement *iface, REFIID riid, vo
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
+        *ppvObject = NULL;
         return E_NOINTERFACE;
     }
 
-- 
1.5.6.5



--------------030803030802030202030205--



More information about the wine-patches mailing list