msi: Fix use of uninitialized variable (Coverity) (Try 2)
James Hawkins
truiken at gmail.com
Sat Jun 23 15:26:29 CDT 2007
On 6/23/07, Andrew Talbot <Andrew.Talbot at talbotville.com> wrote:
> This patch should fix Coverity bug CID-562.
>
> -- Andy.
> ---
> Changelog:
> msi: Fix use of uninitialized variable (Coverity).
>
> diff -urN a/dlls/msi/action.c b/dlls/msi/action.c
> --- a/dlls/msi/action.c 2007-06-18 17:52:27.000000000 +0100
> +++ b/dlls/msi/action.c 2007-06-23 17:08:55.000000000 +0100
> @@ -4648,7 +4648,7 @@
> LPWSTR deformatted, ptr;
> DWORD flags, type, size;
> LONG res;
> - HKEY env, root = HKEY_CURRENT_USER;
> + HKEY env = NULL, root = HKEY_CURRENT_USER;
>
> static const WCHAR environment[] =
> {'S','y','s','t','e','m','\\',
> @@ -4759,7 +4759,7 @@
> res = RegSetValueExW(env, name, 0, type, (LPVOID)newval, size);
>
> done:
> - RegCloseKey(env);
> + if (env) RegCloseKey(env);
> msi_free(deformatted);
> msi_free(data);
> msi_free(newval);
>
Please don't check env for NULL; RegCloseKey will just fail harmlessly
if env is NULL. We spent a lot of time removing such checks.
--
James Hawkins
More information about the wine-devel
mailing list