]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Fix build warnings
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 3 Nov 2016 10:42:25 +0000 (10:42 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Thu, 3 Nov 2016 10:42:44 +0000 (10:42 +0000)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/coinst/coinst.c

index 19ed3b391dc8d194488e5ec4598404627edfd87c..870de27727ef82f2a88c89fc1ea08b0f271812f0 100644 (file)
@@ -110,15 +110,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') {
@@ -300,6 +301,9 @@ fail1:
     return FALSE;
 }
 
+#pragma warning(push)
+#pragma warning(disable:6102) // Using value from failed function call
+
 static BOOLEAN
 IncreaseDiskTimeOut(
     VOID
@@ -388,6 +392,8 @@ fail1:
     return FALSE;
 }
 
+#pragma warning(pop)
+
 static BOOLEAN
 OverrideSanPolicy(
     VOID
@@ -501,14 +507,14 @@ AllowUpdate(
         goto fail3;
     }
 
+    RegCloseKey(ServiceKey);
+
 done:
     if (Value == 0) {
         Log("DISALLOWED");
         *Allow = FALSE;
     }
 
-    RegCloseKey(ServiceKey);
-
     Log("<====");
 
     return TRUE;