hh: Avoid handle leak (coverity)

Alexandre Julliard julliard at winehq.org
Wed Oct 31 05:12:48 CDT 2012


Frédéric Delanoy <frederic.delanoy at gmail.com> writes:

> @@ -27,9 +27,13 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmds
>  
>      HMODULE hModule;
>      DOWINMAIN *doWinMain;
> +    int res;
>  
>      hModule = LoadLibraryA("hhctrl.ocx");
>      doWinMain = (DOWINMAIN*) GetProcAddress(hModule, "doWinMain");
>  
> -    return doWinMain(hInst, cmdline); 
> +    res = doWinMain(hInst, cmdline);
> +    FreeLibrary(hModule);
> +
> +    return res;

Freeing things on process exit is not useful.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list