You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by da...@apache.org on 2021/12/16 06:59:30 UTC
[logging-log4net] branch master updated: (LOG4NET-671) Dispose WindowsIdentity in TryGetCurrentUserName()
This is an automated email from the ASF dual-hosted git repository.
davydm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
The following commit(s) were added to refs/heads/master by this push:
new 6ad127b (LOG4NET-671) Dispose WindowsIdentity in TryGetCurrentUserName()
new 0dbdc6d Merge pull request #79 from erikma/dev/erikmav/disposeWinIdentity
6ad127b is described below
commit 6ad127beb564d4381af634f495df2c14d55d7213
Author: Erik Mavrinac <er...@microsoft.com>
AuthorDate: Wed Dec 1 13:46:33 2021 -0800
(LOG4NET-671) Dispose WindowsIdentity in TryGetCurrentUserName()
---
src/log4net/Core/LoggingEvent.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 4ad16f1..d7fd398 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -931,8 +931,10 @@ namespace log4net.Core
try
{
- var windowsIdentity = WindowsIdentity.GetCurrent();
- return windowsIdentity?.Name ?? "";
+ using (WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent())
+ {
+ return windowsIdentity?.Name ?? "";
+ }
}
catch (PlatformNotSupportedException)
{