[USETUP] Check for invalid INF handles before doing operations.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 23 Dec 2018 15:53:39 +0000 (16:53 +0100)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 23 Dec 2018 19:37:13 +0000 (20:37 +0100)
base/setup/usetup/spapisup/infsupp.c

index af18c49..9821297 100644 (file)
@@ -43,6 +43,8 @@ WINAPI
 SetupCloseInfFile(
     IN HINF InfHandle)
 {
 SetupCloseInfFile(
     IN HINF InfHandle)
 {
+    if (InfHandle == INVALID_HANDLE_VALUE)
+        return;
     InfCloseFile(InfHandle);
 }
 
     InfCloseFile(InfHandle);
 }
 
@@ -58,6 +60,9 @@ SetupFindFirstLineW(
     PINFCONTEXT pContext;
     BOOL ret;
 
     PINFCONTEXT pContext;
     BOOL ret;
 
+    if (InfHandle == INVALID_HANDLE_VALUE)
+        return FALSE;
+
     ret = InfFindFirstLine(InfHandle, Section, Key, &pContext);
     if (!ret)
         return FALSE;
     ret = InfFindFirstLine(InfHandle, Section, Key, &pContext);
     if (!ret)
         return FALSE;