Jacek Caban : urlmon: Avoid accessing an uninitialized variable (valgrind).
Alexandre Julliard
julliard at winehq.org
Fri Jun 3 14:04:42 CDT 2011
Module: wine
Branch: master
Commit: e21c5282e0c629dd99284b097ad4085067279ec5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e21c5282e0c629dd99284b097ad4085067279ec5
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jun 3 11:40:23 2011 +0200
urlmon: Avoid accessing an uninitialized variable (valgrind).
Also a bit of code clean up.
---
dlls/urlmon/internet.c | 41 ++++++++++++++++++-----------------------
1 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/dlls/urlmon/internet.c b/dlls/urlmon/internet.c
index 3832c52..c09bace 100644
--- a/dlls/urlmon/internet.c
+++ b/dlls/urlmon/internet.c
@@ -549,39 +549,34 @@ static HRESULT set_internet_feature(INTERNETFEATURELIST feature, DWORD flags, BO
static BOOL get_feature_from_reg(HKEY feature_control, LPCWSTR feature_name, LPCWSTR process_name, BOOL *enabled)
{
- BOOL ret = FALSE;
+ DWORD type, value, size;
HKEY feature;
DWORD res;
static const WCHAR wildcardW[] = {'*',0};
res = RegOpenKeyW(feature_control, feature_name, &feature);
- if(res == ERROR_SUCCESS) {
- DWORD type, value, size;
+ if(res != ERROR_SUCCESS)
+ return FALSE;
+ size = sizeof(DWORD);
+ res = RegQueryValueExW(feature, process_name, NULL, &type, (BYTE*)&value, &size);
+ if(res != ERROR_SUCCESS || type != REG_DWORD) {
size = sizeof(DWORD);
- res = RegQueryValueExW(feature, process_name, NULL, &type, (BYTE*)&value, &size);
- if(type != REG_DWORD)
- WARN("Unexpected registry value type %d (expected REG_DWORD) for %s\n", type, debugstr_w(process_name));
-
- if(res == ERROR_SUCCESS && type == REG_DWORD) {
- *enabled = value == 1;
- ret = TRUE;
- } else {
- size = sizeof(DWORD);
- res = RegQueryValueExW(feature, wildcardW, NULL, &type, (BYTE*)&value, &size);
- if(type != REG_DWORD)
- WARN("Unexpected registry value type %d (expected REG_DWORD) for %s\n", type, debugstr_w(wildcardW));
-
- if(res == ERROR_SUCCESS && type == REG_DWORD) {
- *enabled = value == 1;
- ret = TRUE;
- }
- }
- RegCloseKey(feature);
+ res = RegQueryValueExW(feature, wildcardW, NULL, &type, (BYTE*)&value, &size);
+ }
+
+ RegCloseKey(feature);
+ if(res != ERROR_SUCCESS)
+ return FALSE;
+
+ if(type != REG_DWORD) {
+ WARN("Unexpected registry value type %d (expected REG_DWORD) for %s\n", type, debugstr_w(wildcardW));
+ return FALSE;
}
- return ret;
+ *enabled = value == 1;
+ return TRUE;
}
/* Assumes 'process_features_cs' is held. */
More information about the wine-cvs
mailing list