]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
Fix build warnings
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 3 Nov 2016 10:30:57 +0000 (10:30 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Thu, 3 Nov 2016 10:37:09 +0000 (10:37 +0000)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/coinst/coinst.c
src/monitor/monitor.c

index f09e548daf29df0da735abb916ad39ffbcaf5213..89d52d0adaf6efc605ea19bef71f5f0defbf8361 100644 (file)
@@ -117,15 +117,16 @@ GetErrorMessage(
     PTCHAR      Message;
     ULONG       Index;
 
-    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
-                  FORMAT_MESSAGE_FROM_SYSTEM |
-                  FORMAT_MESSAGE_IGNORE_INSERTS,
-                  NULL,
-                  Error,
-                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                  (LPTSTR)&Message,
-                  0,
-                  NULL);
+    if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                       FORMAT_MESSAGE_FROM_SYSTEM |
+                       FORMAT_MESSAGE_IGNORE_INSERTS,
+                       NULL,
+                       Error,
+                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                       (LPTSTR)&Message,
+                       0,
+                       NULL))
+        return NULL;
 
     for (Index = 0; Message[Index] != '\0'; Index++) {
         if (Message[Index] == '\r' || Message[Index] == '\n') {
@@ -252,14 +253,14 @@ AllowUpdate(
         goto fail3;
     }
 
+    RegCloseKey(ServiceKey);
+
 done:
     if (Value == 0) {
         Log("DISALLOWED");
         *Allow = FALSE;
     }
 
-    RegCloseKey(ServiceKey);
-
     Log("<====");
 
     return TRUE;
@@ -631,8 +632,10 @@ GetDriverKeyName(
                              0,
                              KEY_READ,
                              &SubKey);
-        if (Error != ERROR_SUCCESS)
+        if (Error != ERROR_SUCCESS) {
+            SubKey = NULL;
             continue;
+        }
 
         Error = RegQueryInfoKey(SubKey,
                                 NULL,
index 69d446ce38c4d20bfa3aaa98b5f31abda1f9cfd0..344ca6dbe7b27a86d7f0bb7f44c277cb3f1a4c1b 100644 (file)
@@ -134,15 +134,16 @@ GetErrorMessage(
     PTCHAR      Message;
     ULONG       Index;
 
-    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                  FORMAT_MESSAGE_FROM_SYSTEM |
-                  FORMAT_MESSAGE_IGNORE_INSERTS,
-                  NULL,
-                  Error,
-                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                  (LPTSTR)&Message,
-                  0,
-                  NULL);
+    if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                       FORMAT_MESSAGE_FROM_SYSTEM |
+                       FORMAT_MESSAGE_IGNORE_INSERTS,
+                       NULL,
+                       Error,
+                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                       (LPTSTR)&Message,
+                       0,
+                       NULL))
+        return NULL;
 
     for (Index = 0; Message[Index] != '\0'; Index++) {
         if (Message[Index] == '\r' || Message[Index] == '\n') {
@@ -304,6 +305,7 @@ DoReboot(
 
     Log("initiating shutdown...");
 
+#pragma prefast(suppress:28159)
     (VOID) InitiateSystemShutdownEx(NULL,
                                     NULL,
                                     0,