mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Fix memory leak in encoding/ini
A simple change that fixes a memory leak caused by not deleting all the values in the map
This commit is contained in:
@@ -92,7 +92,6 @@ load_map_from_string :: proc(src: string, allocator: runtime.Allocator, options
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strings.clone(val)
|
return strings.clone(val)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.allocator = allocator
|
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
|
new_key = strings.to_lower(key) or_return
|
||||||
delete(old_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
|
return
|
||||||
}
|
}
|
||||||
@@ -144,6 +146,7 @@ delete_map :: proc(m: Map) {
|
|||||||
delete(value, allocator)
|
delete(value, allocator)
|
||||||
}
|
}
|
||||||
delete(section)
|
delete(section)
|
||||||
|
delete(pairs)
|
||||||
}
|
}
|
||||||
delete(m)
|
delete(m)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user