Commit 16f4b563 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

shell32: Fix memory leaks in autocomplete tests.

parent 0fd772be
...@@ -33,7 +33,7 @@ static HWND hMainWnd, hEdit; ...@@ -33,7 +33,7 @@ static HWND hMainWnd, hEdit;
static HINSTANCE hinst; static HINSTANCE hinst;
static int killfocus_count; static int killfocus_count;
static BOOL test_init(void) static IAutoComplete *test_init(void)
{ {
HRESULT r; HRESULT r;
IAutoComplete* ac; IAutoComplete* ac;
...@@ -45,7 +45,7 @@ static BOOL test_init(void) ...@@ -45,7 +45,7 @@ static BOOL test_init(void)
if (r == REGDB_E_CLASSNOTREG) if (r == REGDB_E_CLASSNOTREG)
{ {
win_skip("CLSID_AutoComplete is not registered\n"); win_skip("CLSID_AutoComplete is not registered\n");
return FALSE; return NULL;
} }
ok(SUCCEEDED(r), "no IID_IAutoComplete (0x%08x)\n", r); ok(SUCCEEDED(r), "no IID_IAutoComplete (0x%08x)\n", r);
...@@ -55,7 +55,7 @@ static BOOL test_init(void) ...@@ -55,7 +55,7 @@ static BOOL test_init(void)
if (r == REGDB_E_CLASSNOTREG) if (r == REGDB_E_CLASSNOTREG)
{ {
win_skip("CLSID_ACLMulti is not registered\n"); win_skip("CLSID_ACLMulti is not registered\n");
return FALSE; return NULL;
} }
ok(SUCCEEDED(r), "no IID_IACList (0x%08x)\n", r); ok(SUCCEEDED(r), "no IID_IACList (0x%08x)\n", r);
...@@ -63,7 +63,9 @@ static BOOL test_init(void) ...@@ -63,7 +63,9 @@ static BOOL test_init(void)
r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL); r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL);
ok(SUCCEEDED(r), "Init failed (0x%08x)\n", r); ok(SUCCEEDED(r), "Init failed (0x%08x)\n", r);
return TRUE; IUnknown_Release(acSource);
return ac;
} }
static void test_killfocus(void) static void test_killfocus(void)
...@@ -116,6 +118,7 @@ START_TEST(autocomplete) ...@@ -116,6 +118,7 @@ START_TEST(autocomplete)
{ {
HRESULT r; HRESULT r;
MSG msg; MSG msg;
IAutoComplete* ac;
r = CoInitialize(NULL); r = CoInitialize(NULL);
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r); ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r);
...@@ -127,7 +130,8 @@ START_TEST(autocomplete) ...@@ -127,7 +130,8 @@ START_TEST(autocomplete)
if(!ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n")) if(!ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n"))
return; return;
if (!test_init()) ac = test_init();
if (!ac)
goto cleanup; goto cleanup;
test_killfocus(); test_killfocus();
...@@ -137,6 +141,8 @@ START_TEST(autocomplete) ...@@ -137,6 +141,8 @@ START_TEST(autocomplete)
DispatchMessageA(&msg); DispatchMessageA(&msg);
} }
IAutoComplete_Release(ac);
cleanup: cleanup:
DestroyWindow(hEdit); DestroyWindow(hEdit);
DestroyWindow(hMainWnd); DestroyWindow(hMainWnd);
......
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