aboutsummaryrefslogtreecommitdiff
path: root/core/path
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-06-02 12:19:25 +0100
committergingerBill <bill@gingerbill.org>2021-06-02 12:19:25 +0100
commitea6b222430d67162d80630d84adc3ed07bbd3808 (patch)
tree636d8178276a58e5d1896d87864ab4e2410a6175 /core/path
parent91b4bf3daa026c9ce14c520c5e4a8a2b9141c485 (diff)
Clean up filepath.lazy_buffer memory leak
Diffstat (limited to 'core/path')
-rw-r--r--core/path/filepath/path.odin8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/path/filepath/path.odin b/core/path/filepath/path.odin
index 9f1719f3b..eed257f97 100644
--- a/core/path/filepath/path.odin
+++ b/core/path/filepath/path.odin
@@ -169,7 +169,7 @@ clean :: proc(path: string, allocator := context.allocator) -> string {
s := lazy_buffer_string(out);
cleaned, new_allocation := from_slash(s);
if new_allocation {
- delete(s);
+ lazy_buffer_destroy(s);
}
return cleaned;
}
@@ -395,3 +395,9 @@ lazy_buffer_string :: proc(lb: ^Lazy_Buffer) -> string {
copy(z[len(x):], y);
return string(z);
}
+@(private)
+lazy_buffer_destroy :: proc(lb: ^Lazy_Buffer) {
+ delete(lb.b);
+ delete(lb);
+ lb^ = {};
+}