aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-06 18:29:39 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-06 18:34:51 -0400
commitd950805b6c65435158cd64c63c2d2af290061d30 (patch)
tree18326414008baf28a2b066b47c24436dedf318ad /src
parentcdc62a3c9d2a6b6eabf6d18e7c5077b6c861b7c4 (diff)
Run the parser when indexing with the temporary allocator to avoid leaks
Diffstat (limited to 'src')
-rw-r--r--src/server/build.odin14
1 files changed, 10 insertions, 4 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)
+ }
}
}