Skip to content

Commit 4347747

Browse files
committed
Dispose IHtmlDocument objects (fixes #396)
1 parent ae491cc commit 4347747

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/HtmlSanitizer/HtmlSanitizer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ public IHtmlDocument SanitizeDom(IHtmlDocument document, IHtmlElement? context =
406406
public string SanitizeDocument(string html, string baseUrl = "", IMarkupFormatter? outputFormatter = null)
407407
{
408408
var parser = HtmlParserFactory();
409-
var dom = parser.ParseDocument(html);
409+
using var dom = parser.ParseDocument(html);
410410

411411
DoSanitize(dom, dom, baseUrl);
412412

@@ -425,7 +425,7 @@ public string SanitizeDocument(string html, string baseUrl = "", IMarkupFormatte
425425
public string SanitizeDocument(Stream html, string baseUrl = "", IMarkupFormatter? outputFormatter = null)
426426
{
427427
var parser = HtmlParserFactory();
428-
var dom = parser.ParseDocument(html);
428+
using var dom = parser.ParseDocument(html);
429429

430430
DoSanitize(dom, dom, baseUrl);
431431

0 commit comments

Comments
 (0)