< prev index next >
src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
Print this page
rev 51041 : imported patch 8207145-Memory-leak-in-WindowsNativeDispatcher
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -1041,12 +1041,15 @@
PLUID pLuid = LocalAlloc(0, sizeof(LUID));
if (pLuid == NULL) {
JNU_ThrowInternalError(env, "Unable to allocate LUID structure");
} else {
- if (LookupPrivilegeValueW(NULL, lpName, pLuid) == 0)
+ if (LookupPrivilegeValueW(NULL, lpName, pLuid) == 0) {
+ LocalFree(pLuid);
throwWindowsException(env, GetLastError());
+ return (jlong)0;
+ }
}
return ptr_to_jlong(pLuid);
}
JNIEXPORT void JNICALL
< prev index next >