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

index 0d792f75af2a55630a515a2e35bea2cdb078d660..36baa241d763a3929ec08fbc6989861d7133a22d 100644 (file)
@@ -112,15 +112,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') {
@@ -294,14 +295,14 @@ AllowUpdate(
         goto fail3;
     }
 
+    RegCloseKey(ServiceKey);
+
 done:
     if (Value == 0) {
         Log("DISALLOWED");
         *Allow = FALSE;
     }
 
-    RegCloseKey(ServiceKey);
-
     Log("<====");
 
     return TRUE;
@@ -554,8 +555,10 @@ GetDriverKeyName(
                              0,
                              KEY_READ,
                              &SubKey);
-        if (Error != ERROR_SUCCESS)
+        if (Error != ERROR_SUCCESS) {
+            SubKey = NULL;
             continue;
+        }
 
         Error = RegQueryInfoKey(SubKey,
                                 NULL,
index a90397a5df4d6f6fafd5d9e8dc1dde9d91b80911..641481978d882c4b25ca3a5ce04c9a1569134c66 100644 (file)
@@ -119,6 +119,7 @@ __ControllerReleaseLock(
     IN  PXENVIF_CONTROLLER  Controller
     )
 {
+#pragma prefast(suppress:26110) // Caller failing to hold lock
     KeReleaseSpinLockFromDpcLevel(&Controller->Lock);
 }