mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 05:06:15 +00:00
atl: Avoid NULL pointer reference in AtlComModuleRevokeClassObjects().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
This commit is contained in:
parent
f4890dac17
commit
2f3b916d05
|
@ -598,6 +598,9 @@ HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
|
|||
return E_INVALIDARG;
|
||||
|
||||
for(iter = module->m_ppAutoObjMapFirst; iter < module->m_ppAutoObjMapLast; iter++) {
|
||||
if(!(*iter))
|
||||
continue;
|
||||
|
||||
hres = CoRevokeClassObject((*iter)->dwRegister);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
@ -617,6 +620,9 @@ HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
|
|||
return E_INVALIDARG;
|
||||
|
||||
for(iter = module->m_ppAutoObjMapFirst; iter < module->m_ppAutoObjMapLast; iter++) {
|
||||
if(!(*iter))
|
||||
continue;
|
||||
|
||||
hres = CoRevokeClassObject((*iter)->pCache->dwRegister);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
|
|
@ -1115,6 +1115,31 @@ static void test_AtlComModuleRegisterClassObjects(void)
|
|||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
}
|
||||
|
||||
static void test_AtlComModuleRevokeClassObjects(void)
|
||||
{
|
||||
_ATL_OBJMAP_ENTRY *null_entry = NULL;
|
||||
_ATL_COM_MODULE module;
|
||||
HRESULT hr;
|
||||
|
||||
/* Test NULL module */
|
||||
hr = AtlComModuleRevokeClassObjects(NULL);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
|
||||
module.cbSize = sizeof(module);
|
||||
module.m_ppAutoObjMapFirst = NULL;
|
||||
module.m_ppAutoObjMapLast = NULL;
|
||||
hr = AtlComModuleRevokeClassObjects(&module);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
|
||||
module.cbSize = sizeof(module);
|
||||
module.m_ppAutoObjMapFirst = &null_entry;
|
||||
module.m_ppAutoObjMapLast = &null_entry;
|
||||
hr = AtlComModuleRevokeClassObjects(&module);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
}
|
||||
|
||||
START_TEST(atl)
|
||||
{
|
||||
if (!register_class())
|
||||
|
@ -1132,6 +1157,7 @@ START_TEST(atl)
|
|||
test_AtlAxCreateControl();
|
||||
test_AtlComModuleGetClassObject();
|
||||
test_AtlComModuleRegisterClassObjects();
|
||||
test_AtlComModuleRevokeClassObjects();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
|
@ -82,12 +82,38 @@ static void test_AtlComModuleRegisterClassObjects(void)
|
|||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
}
|
||||
|
||||
static void test_AtlComModuleRevokeClassObjects(void)
|
||||
{
|
||||
_ATL_OBJMAP_ENTRY_EX *null_entry = NULL;
|
||||
_ATL_COM_MODULE module;
|
||||
HRESULT hr;
|
||||
|
||||
/* Test NULL module */
|
||||
hr = AtlComModuleRevokeClassObjects(NULL);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
|
||||
module.cbSize = sizeof(module);
|
||||
module.m_ppAutoObjMapFirst = NULL;
|
||||
module.m_ppAutoObjMapLast = NULL;
|
||||
hr = AtlComModuleRevokeClassObjects(&module);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
|
||||
module.cbSize = sizeof(module);
|
||||
module.m_ppAutoObjMapFirst = &null_entry;
|
||||
module.m_ppAutoObjMapLast = &null_entry;
|
||||
hr = AtlComModuleRevokeClassObjects(&module);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
}
|
||||
|
||||
START_TEST(atl)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_AtlComModuleGetClassObject();
|
||||
test_AtlComModuleRegisterClassObjects();
|
||||
test_AtlComModuleRevokeClassObjects();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue