Nikolay Sivov : oleaut32: Fix null parameters handling in ICreateTypeLib2:: CreateTypeInfo().
Alexandre Julliard
julliard at winehq.org
Thu Dec 23 11:28:02 CST 2010
Module: wine
Branch: master
Commit: 623abfcaaed2f8809b7398984eea6d85f9162355
URL: http://source.winehq.org/git/wine.git/?a=commit;h=623abfcaaed2f8809b7398984eea6d85f9162355
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Dec 22 23:50:51 2010 +0300
oleaut32: Fix null parameters handling in ICreateTypeLib2::CreateTypeInfo().
---
dlls/oleaut32/tests/typelib.c | 10 ++++++++++
dlls/oleaut32/typelib2.c | 11 ++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 495561a..aab340e 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -1406,6 +1406,16 @@ static void test_CreateTypeLib(void) {
SysFreeString(name);
SysFreeString(helpfile);
+ /* invalid parameters */
+ hres = ICreateTypeLib_CreateTypeInfo(createtl, NULL, TKIND_INTERFACE, &createti);
+ ok(hres == E_INVALIDARG, "got %08x\n", hres);
+
+ hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, NULL);
+ ok(hres == E_INVALIDARG, "got %08x\n", hres);
+
+ hres = ICreateTypeLib_CreateTypeInfo(createtl, NULL, TKIND_INTERFACE, NULL);
+ ok(hres == E_INVALIDARG, "got %08x\n", hres);
+
hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
ok(hres == S_OK, "got %08x\n", hres);
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index e0e78ee..8fc8a92 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -4389,20 +4389,21 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(
ICreateTypeLib2 * iface,
LPOLESTR szName,
TYPEKIND tkind,
- ICreateTypeInfo **ppCTInfo)
+ ICreateTypeInfo **tinfo)
{
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
char *name;
- TRACE("(%p,%s,%d,%p)\n", iface, debugstr_w(szName), tkind, ppCTInfo);
+ TRACE("(%p,%s,%d,%p)\n", iface, debugstr_w(szName), tkind, tinfo);
+
+ if (!szName || !tinfo) return E_INVALIDARG;
ctl2_encode_name(This, szName, &name);
if(ctl2_find_name(This, name) != -1)
return TYPE_E_NAMECONFLICT;
- *ppCTInfo = (ICreateTypeInfo *)ICreateTypeInfo2_Constructor(This, szName, tkind);
-
- if (!*ppCTInfo) return E_OUTOFMEMORY;
+ *tinfo = (ICreateTypeInfo *)ICreateTypeInfo2_Constructor(This, szName, tkind);
+ if (!*tinfo) return E_OUTOFMEMORY;
return S_OK;
}
More information about the wine-cvs
mailing list