From 4e73e7b2e021d4534f2a34e97918ca82663cbc7e Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Fri, 22 Mar 2019 17:53:34 +0530 Subject: [PATCH] macOS: Syntax highlighter: Free spans array --- WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift index 6da5c98..3c92db3 100644 --- a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift +++ b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift @@ -150,6 +150,7 @@ class ConfTextStorage: NSTextStorage { var spans = highlight_config(backingStore.string)! evaluateExcludePrivateIPs(highlightSpans: spans) + let spansStart = spans while spans.pointee.type != HighlightEnd { let span = spans.pointee @@ -169,6 +170,7 @@ class ConfTextStorage: NSTextStorage { spans = spans.successor() } backingStore.endEditing() + free(spansStart) beginEditing() edited(.editedAttributes, range: fullTextRange, changeInLength: 0)