Skip to content

Commit d084ded

Browse files
Rugerize waf encoder disposal
1 parent b6e31df commit d084ded

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tracer/src/Datadog.Trace/AppSec/Security.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ private string GetHtmlResponse()
487487
public void Dispose()
488488
{
489489
_waf?.Dispose();
490-
Encoder.Pool.Dispose();
490+
Encoder.Dispose();
491491
_activeAddressesLocker.Dispose();
492492
}
493493

tracer/src/Datadog.Trace/AppSec/WafEncoding/Encoder.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ internal static UnmanagedMemoryPool Pool
4747
}
4848
}
4949

50+
internal static void Dispose()
51+
{
52+
try
53+
{
54+
if (_pool is { IsDisposed: false })
55+
{
56+
_pool.Dispose();
57+
_pool = null;
58+
}
59+
}
60+
catch (Exception ex)
61+
{
62+
Log.Debug(ex, "WafEncoder Crashed on shutdown.");
63+
}
64+
}
65+
5066
/// <summary>
5167
/// For testing purposes
5268
/// </summary>

0 commit comments

Comments
 (0)