diff options
| author | Ronald <ronald1985@tutamail.com> | 2024-07-17 21:19:14 +0100 |
|---|---|---|
| committer | Ronald <ronald1985@tutamail.com> | 2024-07-17 21:19:14 +0100 |
| commit | f04db7145cf2bbd58c05861a0e8a9a601697fed9 (patch) | |
| tree | 683a64bab1a0088d657e135f7e21c88b213d99ee /core/encoding | |
| parent | 0bb4cc6ce5230ef2fa47a1b614d359710ea4271a (diff) | |
Fix memory leak in encoding/ini
A simple change that fixes a memory leak caused by not deleting all the
values in the map
Diffstat (limited to 'core/encoding')
| -rw-r--r-- | core/encoding/ini/ini.odin | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/encoding/ini/ini.odin b/core/encoding/ini/ini.odin index 6723da2b3..2af13efd9 100644 --- a/core/encoding/ini/ini.odin +++ b/core/encoding/ini/ini.odin @@ -92,7 +92,6 @@ load_map_from_string :: proc(src: string, allocator: runtime.Allocator, options } } return strings.clone(val) - } context.allocator = allocator @@ -114,7 +113,10 @@ load_map_from_string :: proc(src: string, allocator: runtime.Allocator, options new_key = strings.to_lower(key) or_return delete(old_key) or_return } - pairs[new_key] = unquote(value) or_return + pairs[new_key], err = unquote(value) + if err != nil { + return + } } return } @@ -144,6 +146,7 @@ delete_map :: proc(m: Map) { delete(value, allocator) } delete(section) + delete(pairs) } delete(m) } |