diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-07-07 01:38:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-07 01:38:07 +0200 |
| commit | 696edc2f3beb989405ef1247664d084f579174b0 (patch) | |
| tree | b46ee55ed92db48282d32eb56455813d1752e081 /src/server | |
| parent | cdc62a3c9d2a6b6eabf6d18e7c5077b6c861b7c4 (diff) | |
| parent | 9db96ce7f5186d510ee3992b6af5bb66997aa875 (diff) | |
Merge pull request #727 from BradLewis/resolve-leak
Resolve leak
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/build.odin | 14 | ||||
| -rw-r--r-- | src/server/requests.odin | 1 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/server/build.odin b/src/server/build.odin index 9db5c43..b8056fe 100644 --- a/src/server/build.odin +++ b/src/server/build.odin @@ -232,11 +232,17 @@ index_file :: proc(uri: common.Uri, text: string) -> common.Error { pkg = pkg, } - ok = parser.parse_file(&p, &file) + { + allocator := context.allocator + context.allocator = context.temp_allocator + defer context.allocator = allocator + + ok = parser.parse_file(&p, &file) - if !ok { - if !strings.contains(fullpath, "builtin.odin") && !strings.contains(fullpath, "intrinsics.odin") { - log.errorf("error in parse file for indexing %v", fullpath) + if !ok { + if !strings.contains(fullpath, "builtin.odin") && !strings.contains(fullpath, "intrinsics.odin") { + log.errorf("error in parse file for indexing %v", fullpath) + } } } diff --git a/src/server/requests.odin b/src/server/requests.odin index 92bd8aa..77e4ca7 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -289,7 +289,6 @@ consume_requests :: proc(config: ^common.Config, writer: ^Writer) -> bool { request := temp_requests[request_index] call(request.value, request.id, writer, config) clear_index_cache() - json.destroy_value(request.value) free_all(context.temp_allocator) } |