Rob Shearman : shell32: Fix memory leaks in autocomplete tests.
Module: wine Branch: master Commit: 16f4b56345a5928fe8528d3d3305ef7c15284440 URL: http://source.winehq.org/git/wine.git/?a=commit;h=16f4b56345a5928fe8528d3d33... Author: Rob Shearman <robertshearman(a)gmail.com> Date: Tue Dec 29 19:02:16 2009 +0000 shell32: Fix memory leaks in autocomplete tests. --- dlls/shell32/tests/autocomplete.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/shell32/tests/autocomplete.c b/dlls/shell32/tests/autocomplete.c index ab60259..042e238 100644 --- a/dlls/shell32/tests/autocomplete.c +++ b/dlls/shell32/tests/autocomplete.c @@ -33,7 +33,7 @@ static HWND hMainWnd, hEdit; static HINSTANCE hinst; static int killfocus_count; -static BOOL test_init(void) +static IAutoComplete *test_init(void) { HRESULT r; IAutoComplete* ac; @@ -45,7 +45,7 @@ static BOOL test_init(void) if (r == REGDB_E_CLASSNOTREG) { win_skip("CLSID_AutoComplete is not registered\n"); - return FALSE; + return NULL; } ok(SUCCEEDED(r), "no IID_IAutoComplete (0x%08x)\n", r); @@ -55,7 +55,7 @@ static BOOL test_init(void) if (r == REGDB_E_CLASSNOTREG) { win_skip("CLSID_ACLMulti is not registered\n"); - return FALSE; + return NULL; } ok(SUCCEEDED(r), "no IID_IACList (0x%08x)\n", r); @@ -63,7 +63,9 @@ static BOOL test_init(void) r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL); ok(SUCCEEDED(r), "Init failed (0x%08x)\n", r); - return TRUE; + IUnknown_Release(acSource); + + return ac; } static void test_killfocus(void) @@ -116,6 +118,7 @@ START_TEST(autocomplete) { HRESULT r; MSG msg; + IAutoComplete* ac; r = CoInitialize(NULL); ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r); @@ -127,7 +130,8 @@ START_TEST(autocomplete) if(!ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n")) return; - if (!test_init()) + ac = test_init(); + if (!ac) goto cleanup; test_killfocus(); @@ -137,6 +141,8 @@ START_TEST(autocomplete) DispatchMessageA(&msg); } + IAutoComplete_Release(ac); + cleanup: DestroyWindow(hEdit); DestroyWindow(hMainWnd);
participants (1)
-
Alexandre Julliard