aboutsummaryrefslogtreecommitdiff
path: root/core/encoding/base32
diff options
context:
space:
mode:
authorZoltán Kéri <z@zolk3ri.name>2024-12-30 12:00:38 +0100
committerZoltán Kéri <z@zolk3ri.name>2024-12-30 12:00:38 +0100
commit591dd8765adb04ff5e0ba66c4c583ea49dbbcc87 (patch)
tree091d46eea9321041ade8b617622e5f6c0fd8e1dc /core/encoding/base32
parent0d4c0064d961d8a50901afd8c359962b687d1cbd (diff)
encoding/base32: Remove incorrect defer delete in encode()
Remove premature deallocation of the output buffer which was causing use-after-free behavior. The returned string needs to take ownership of this memory, but the defer delete was freeing it before the string could be used. This fixes issues with encoding that were introduced by overly aggressive memory cleanup in 93238db2.
Diffstat (limited to 'core/encoding/base32')
-rw-r--r--core/encoding/base32/base32.odin1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/encoding/base32/base32.odin b/core/encoding/base32/base32.odin
index 60ece7b26..c46d4a323 100644
--- a/core/encoding/base32/base32.odin
+++ b/core/encoding/base32/base32.odin
@@ -54,7 +54,6 @@ DEC_TABLE := [256]u8 {
encode :: proc(data: []byte, ENC_TBL := ENC_TABLE, allocator := context.allocator) -> string {
out_length := (len(data) + 4) / 5 * 8
out := make([]byte, out_length, allocator)
- defer delete(out)
_encode(out, data, ENC_TBL)
return string(out[:])
}