[ros-diffs] [hyperion] 37219: modified dll/win32/advapi32/misc/shutdown.c modified dll/win32/advapi32/reg/reg.c modified dll/win32/advapi32/sec/misc.c Don't use potentially uninitialized variables. Courtesy of Visual C++ modified dll/win32/advapi32/service/eventlog.c Fixed constness warning

hyperion at svn.reactos.org hyperion at svn.reactos.org
Thu Nov 6 00:16:47 CET 2008


Author: hyperion
Date: Wed Nov  5 17:16:46 2008
New Revision: 37219

URL: http://svn.reactos.org/svn/reactos?rev=37219&view=rev
Log:
modified   dll/win32/advapi32/misc/shutdown.c
modified   dll/win32/advapi32/reg/reg.c
modified   dll/win32/advapi32/sec/misc.c
   Don't use potentially uninitialized variables. Courtesy of Visual C++

modified   dll/win32/advapi32/service/eventlog.c
   Fixed constness warning

Modified:
    branches/the-real-msvc/dll/win32/advapi32/misc/shutdown.c
    branches/the-real-msvc/dll/win32/advapi32/reg/reg.c
    branches/the-real-msvc/dll/win32/advapi32/sec/misc.c
    branches/the-real-msvc/dll/win32/advapi32/service/eventlog.c

Modified: branches/the-real-msvc/dll/win32/advapi32/misc/shutdown.c
URL: http://svn.reactos.org/svn/reactos/branches/the-real-msvc/dll/win32/advapi32/misc/shutdown.c?rev=37219&r1=37218&r2=37219&view=diff
==============================================================================
--- branches/the-real-msvc/dll/win32/advapi32/misc/shutdown.c [iso-8859-1] (original)
+++ branches/the-real-msvc/dll/win32/advapi32/misc/shutdown.c [iso-8859-1] Wed Nov  5 17:16:46 2008
@@ -109,6 +109,9 @@
     INT         LastError;
     BOOL        rv;
 
+	MachineNameW.Buffer = NULL;
+	MessageW.Buffer = NULL;
+
     if (lpMachineName)
     {
         RtlInitAnsiString(&MachineNameA, lpMachineName);
@@ -126,7 +129,7 @@
         Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
         if (STATUS_SUCCESS != Status)
         {
-            if (MachineNameW.Length)
+            if (MachineNameW.Buffer)
             {
                 RtlFreeUnicodeString(&MachineNameW);
             }

Modified: branches/the-real-msvc/dll/win32/advapi32/reg/reg.c
URL: http://svn.reactos.org/svn/reactos/branches/the-real-msvc/dll/win32/advapi32/reg/reg.c?rev=37219&r1=37218&r2=37219&view=diff
==============================================================================
--- branches/the-real-msvc/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ branches/the-real-msvc/dll/win32/advapi32/reg/reg.c [iso-8859-1] Wed Nov  5 17:16:46 2008
@@ -917,6 +917,8 @@
   LocalObjectAttributes.ObjectName = &LocalKeyName;
   FullNameLength = LocalKeyName.Length / sizeof(WCHAR);
 
+  LocalKeyHandle = NULL;
+
   /* Remove the last part of the key name and try to create the key again. */
   while (Status == STATUS_OBJECT_NAME_NOT_FOUND)
     {
@@ -949,7 +951,8 @@
   Length = wcslen (LocalKeyName.Buffer);
   while (TRUE)
     {
-      NtClose (LocalKeyHandle);
+      if (LocalKeyHandle)
+	NtClose (LocalKeyHandle);
 
       LocalKeyName.Buffer[Length] = L'\\';
       Length = wcslen (LocalKeyName.Buffer);
@@ -2544,7 +2547,7 @@
 		}
 	}
 
-	TRACE("Key Namea0 Length %d\n", StringU.Length);
+	/*TRACE("Key Namea0 Length %d\n", StringU.Length);*/ /* BUGBUG could be uninitialized */
 	TRACE("Key Namea1 Length %d\n", NameLength);
 	TRACE("Key Namea Length %d\n", *lpcbName);
 	TRACE("Key Namea %s\n", lpName);
@@ -4685,12 +4688,13 @@
     {
       RtlCreateUnicodeStringFromAsciiz (&ValueName,
 					(PSTR)lpValueName);
-      pValueName = (LPWSTR)ValueName.Buffer;
     }
   else
     {
-      pValueName = NULL;
-    }
+      ValueName.Buffer = NULL;
+    }
+
+  pValueName = (LPWSTR)ValueName.Buffer;
 
   if (((dwType == REG_SZ) ||
        (dwType == REG_MULTI_SZ) ||

Modified: branches/the-real-msvc/dll/win32/advapi32/sec/misc.c
URL: http://svn.reactos.org/svn/reactos/branches/the-real-msvc/dll/win32/advapi32/sec/misc.c?rev=37219&r1=37218&r2=37219&view=diff
==============================================================================
--- branches/the-real-msvc/dll/win32/advapi32/sec/misc.c [iso-8859-1] (original)
+++ branches/the-real-msvc/dll/win32/advapi32/sec/misc.c [iso-8859-1] Wed Nov  5 17:16:46 2008
@@ -1252,6 +1252,8 @@
         RtlCreateUnicodeStringFromAsciiz(&SystemName,
                                          (LPSTR)lpSystemName);
     }
+	else
+		SystemName.Buffer = NULL;
 
     /* Check the privilege name is not NULL */
     if (lpName == NULL)
@@ -1263,14 +1265,14 @@
     RtlCreateUnicodeStringFromAsciiz(&Name,
                                      (LPSTR)lpName);
 
-    Result = LookupPrivilegeValueW((lpSystemName != NULL) ? SystemName.Buffer : NULL,
+    Result = LookupPrivilegeValueW(SystemName.Buffer,
                                    Name.Buffer,
                                    lpLuid);
 
     RtlFreeUnicodeString(&Name);
 
     /* Remote system? */
-    if (lpSystemName != NULL)
+    if (SystemName.Buffer != NULL)
     {
         RtlFreeUnicodeString(&SystemName);
     }

Modified: branches/the-real-msvc/dll/win32/advapi32/service/eventlog.c
URL: http://svn.reactos.org/svn/reactos/branches/the-real-msvc/dll/win32/advapi32/service/eventlog.c?rev=37219&r1=37218&r2=37219&view=diff
==============================================================================
--- branches/the-real-msvc/dll/win32/advapi32/service/eventlog.c [iso-8859-1] (original)
+++ branches/the-real-msvc/dll/win32/advapi32/service/eventlog.c [iso-8859-1] Wed Nov  5 17:16:46 2008
@@ -872,7 +872,7 @@
 
     HeapFree(GetProcessHeap(),
              0,
-             wideStrArray);
+             (PVOID)wideStrArray);
 
     return ret;
 }



More information about the Ros-diffs mailing list