From 14749ce02b96951a1c830810deb24148aa944852 Mon Sep 17 00:00:00 2001 From: Alexandros Naskos Date: Sun, 17 May 2020 18:21:02 +0300 Subject: [PATCH] Added missing errdefer --- src/document_store.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/document_store.zig b/src/document_store.zig index 7d52f57..478fd08 100644 --- a/src/document_store.zig +++ b/src/document_store.zig @@ -316,7 +316,9 @@ pub const AnalysisContext = struct { // Swap handles and get new tree. // This takes ownership of the passed uri and text. - self.handle = try newDocument(self.store, try std.mem.dupe(allocator, u8, final_uri), file_contents); + const duped_final_uri = try std.mem.dupe(allocator, u8, final_uri); + errdefer allocator.free(duped_final_uri); + self.handle = try newDocument(self.store, duped_final_uri, file_contents); } // Free old tree, add new one if it exists.