win32_set_security_descriptor(): Check handle before closing
authorEric Biggers <ebiggers3@gmail.com>
Mon, 30 Dec 2013 07:36:48 +0000 (01:36 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 30 Dec 2013 07:36:48 +0000 (01:36 -0600)
src/win32_apply.c

index 312bd87..6ac9e40 100644 (file)
@@ -578,7 +578,7 @@ win32_set_security_descriptor(const wchar_t *path, const u8 *desc,
        ret = 0;
 out_close:
 #ifdef WITH_NTDLL
-       if (func_NtSetSecurityObject)
+       if (func_NtSetSecurityObject && h != INVALID_HANDLE_VALUE)
                CloseHandle(h);
 #endif
        return ret;