setupapi: Fix SETUPDI_OpenDrvKey

Alexandre Julliard julliard at winehq.org
Fri Jul 8 08:28:53 CDT 2011


Christian Inci <chris.pcguy.inci at gmail.com> writes:

> @@ -3728,8 +3728,13 @@ static HKEY SETUPDI_OpenDrvKey(struct DeviceInfo *devInfo, REGSAM samDesired)
>          WCHAR devId[10];
>  
>          sprintfW(devId, fmt, devInfo->devId);
> -        RegOpenKeyExW(classKey, devId, 0, samDesired, &key);
> -        RegCloseKey(classKey);
> +        l = RegOpenKeyExW(classKey, devId, 0, samDesired, &key);
> +        if (!l) {
> +            RegCloseKey(classKey);
> +        } else {
> +            SetLastError(ERROR_KEY_DOES_NOT_EXIST);
> +            return INVALID_HANDLE_VALUE;
> +        }

You are leaking the key now. 

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list