Module: wine Branch: master Commit: 8ebf950b8fb2753c4587dc22f58cc84b814cbee7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8ebf950b8fb2753c4587dc22f5...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Jun 3 11:40:33 2011 +0200
urlmon: Avoid accessing an uninitialized variable (valgrind).
---
dlls/urlmon/sec_mgr.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 7b4bb35..e1763fc 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -256,18 +256,24 @@ static BOOL get_zone_for_scheme(HKEY key, LPCWSTR schema, DWORD *zone)
/* See if the key contains a value for the scheme first. */ res = RegQueryValueExW(key, schema, NULL, &type, (BYTE*)zone, &size); - if(type != REG_DWORD) + if(res == ERROR_SUCCESS) { + if(type == REG_DWORD) + return TRUE; WARN("Unexpected value type %d for value %s, expected REG_DWORD\n", type, debugstr_w(schema)); + } + + /* Try to get the zone for the wildcard scheme. */ + size = sizeof(DWORD); + res = RegQueryValueExW(key, wildcardW, NULL, &type, (BYTE*)zone, &size); + if(res != ERROR_SUCCESS) + return FALSE;
- if(res != ERROR_SUCCESS || type != REG_DWORD) { - /* Try to get the zone for the wildcard scheme. */ - size = sizeof(DWORD); - res = RegQueryValueExW(key, wildcardW, NULL, &type, (BYTE*)zone, &size); - if(type != REG_DWORD) - WARN("Unexpected value type %d for value %s, expected REG_DWORD\n", type, debugstr_w(wildcardW)); + if(type != REG_DWORD) { + WARN("Unexpected value type %d for value %s, expected REG_DWORD\n", type, debugstr_w(wildcardW)); + return FALSE; }
- return res == ERROR_SUCCESS && type == REG_DWORD; + return TRUE; }
/********************************************************************