diff options
| author | doongjohn <doongjohn@gmail.com> | 2025-10-28 19:24:32 +0900 |
|---|---|---|
| committer | doongjohn <doongjohn@gmail.com> | 2025-10-28 19:24:32 +0900 |
| commit | 3ac074751d975b7b9faa2605dbb3e283c582ea36 (patch) | |
| tree | c0469fbbc4c4c3d6e7b5a09c96355b01ff8599d5 /src | |
| parent | 6c1c90ed004058030ece022bafde11906b28fd5a (diff) | |
Fix memory leak when reinitializing the collections.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/requests.odin | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/server/requests.odin b/src/server/requests.odin index f9ef87b..8914cd3 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -444,13 +444,20 @@ read_ols_initialize_options :: proc(config: ^common.Config, ols_config: OlsConfi config.enable_fake_method = ols_config.enable_fake_methods.(bool) or_else config.enable_fake_method - - for it in ols_config.collections { - if it.name in config.collections { - delete(config.collections[it.name]) - delete_key(&config.collections, it.name) + // Delete old keys. + { + old_keys := make([dynamic]string) + defer delete(old_keys) + for k, v in common.config.collections { + append(&old_keys, k) } + for k in old_keys { + delete_key(&common.config.collections, k) + delete(k) + } + } + for it in ols_config.collections { forward_path, _ := filepath.to_slash(it.path, context.temp_allocator) forward_path = common.resolve_home_dir(forward_path, context.temp_allocator) |