aboutsummaryrefslogtreecommitdiff
path: root/src/server/documents.odin
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2020-12-10 12:24:34 +0100
committerDanielGavin <danielgavin5@hotmail.com>2020-12-10 12:24:34 +0100
commitd5292bcd9c67893804929a4095d4a064ed2b00ce (patch)
tree7f51f4d211438c6118584976b45f2b0ee97876d3 /src/server/documents.odin
parent31e8c8686af972b033ba9567d7f34cf4cadf7f10 (diff)
fixed memory leaks.
Diffstat (limited to 'src/server/documents.odin')
-rw-r--r--src/server/documents.odin17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/server/documents.odin b/src/server/documents.odin
index 87c83c3..7e9aa67 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -49,6 +49,17 @@ DocumentStorage :: struct {
document_storage: DocumentStorage;
document_storage_shutdown :: proc() {
+
+ for k, v in document_storage.documents {
+ delete(k);
+ }
+
+ for alloc in document_storage.free_allocators {
+ common.scratch_allocator_destroy(alloc);
+ free(alloc);
+ }
+
+ delete(document_storage.free_allocators);
delete(document_storage.documents);
}
@@ -387,12 +398,12 @@ parse_document :: proc(document: ^Document, config: ^common.Config) -> ([] Parse
for imp, index in document.ast.imports {
- //ERROR no completion on imp!
-
//collection specified
if i := strings.index(imp.fullpath, ":"); i != -1 && i > 1 {
- //Note(Daniel, assuming absolute path atm, but that will change)
+ if len(imp.fullpath) < 2 {
+ continue;
+ }
collection := imp.fullpath[1:i];
p := imp.fullpath[i+1:len(imp.fullpath)-1];