Windows: InstNetProvider do not leak key handle
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 7 Oct 2015 22:09:17 +0000 (18:09 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 8 Oct 2015 03:37:36 +0000 (23:37 -0400)
If we open a handle, close it.

Change-Id: I1a5b2308a91f3c66791e65f76ca17ae52d34789f
Reviewed-on: http://gerrit.openafs.org/12050
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/afsd_service.c

index 4361888..c736706 100644 (file)
@@ -1266,7 +1266,7 @@ static DWORD
 InstNetProvider(const char *svcname, int bInst, const char *before)
 {
     const char *strOrder = NULL;
-    HKEY hkOrder;
+    HKEY hkOrder = NULL;
     LONG rv;
     DWORD dwSize;
     HANDLE hProcHeap;
@@ -1299,6 +1299,8 @@ InstNetProvider(const char *svcname, int bInst, const char *before)
     }
 
   out:
+    if (hkOrder)
+       RegCloseKey(hkOrder);
     free(strOrder);
     return rv;
 }