SHQueryValueExW and Valgrind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SHQueryValueExW would use the output parameters of RegQueryValueExW even if the registry value did not exist. In particular it used dwType which is not initialized in case of a failure thus causing a Valgrind warning.


Changelog:


* dlls/shlwapi/reg.c

Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
Don't use the data returned by RegQueryValueExW if it fails (found by Valgrind).
A spelling fix.


--
Francois Gouget
fgouget@xxxxxxxxxxxxxxx

Index: dlls/shlwapi/reg.c
===================================================================
RCS file: /home/cvs/wine/dlls/shlwapi/reg.c,v
retrieving revision 1.43
diff -u -r1.43 reg.c
--- dlls/shlwapi/reg.c	15 Oct 2003 21:02:53 -0000	1.43
+++ dlls/shlwapi/reg.c	19 Nov 2003 21:31:49 -0000
@@ -1240,6 +1240,8 @@
   if (pcbData) dwUnExpDataLen = *pcbData;
 
   dwRet = RegQueryValueExW(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
+  if (dwRet!=ERROR_SUCCESS && dwRet!=ERROR_MORE_DATA)
+      return dwRet;
 
   if (pcbData && (dwType == REG_EXPAND_SZ))
   {
@@ -1248,7 +1250,7 @@
     /* Expand type REG_EXPAND_SZ into REG_SZ */
     LPWSTR szData;
 
-    /* If the caller didn't supply a buffer or the buffer is to small we have
+    /* If the caller didn't supply a buffer or the buffer is too small we have
      * to allocate our own
      */
     if ((!pvData) || (dwRet == ERROR_MORE_DATA) )

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux