Skip to content

Commit 0dbdc6d

Browse files
authored
Merge pull request #79 from erikma/dev/erikmav/disposeWinIdentity
2 parents 0b9f537 + 6ad127b commit 0dbdc6d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/log4net/Core/LoggingEvent.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,10 @@ private static string TryGetCurrentUserName()
937937

938938
try
939939
{
940-
var windowsIdentity = WindowsIdentity.GetCurrent();
941-
return windowsIdentity?.Name ?? "";
940+
using (WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent())
941+
{
942+
return windowsIdentity?.Name ?? "";
943+
}
942944
}
943945
catch (PlatformNotSupportedException)
944946
{

0 commit comments

Comments
 (0)