[PATCH 2/2] msi: handle some error returns (Coverity)

Marcus Meissner meissner at suse.de
Thu Feb 4 08:26:53 CST 2010


Hi,

Handle some errors by leaving the test function earlier.

Ciao, Marcus
---
 dlls/msi/tests/install.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 153f51a..066dd22 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -7461,6 +7461,7 @@ static void test_start_services(void)
     }
     scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
     ok(scm != NULL, "Failed to open the SC Manager\n");
+    if (!scm) return;
 
     service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
     if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
@@ -7469,7 +7470,11 @@ static void test_start_services(void)
         CloseServiceHandle(scm);
         return;
     }
-    ok(service != NULL, "Failed to open Spooler\n");
+    ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
+    if (!service) {
+        CloseServiceHandle(scm);
+        return; 
+    }
 
     ret = StartService(service, 0, NULL);
     if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
-- 
1.6.5.7



More information about the wine-patches mailing list