Skip to content

Commit b26d95c

Browse files
committed
free webui buffers
1 parent 67939ef commit b26d95c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

webui.nim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,21 @@ proc encode*(str: string): string =
5454
##
5555
## :str: The string to encode.
5656

57-
$ bindings.encode(cstring str)
57+
var cstr = bindings.encode(cstring str)
58+
result = $cstr
59+
60+
bindings.free(addr cstr)
5861

5962
proc decode*(str: string): string =
6063
## Base64 decoding. Use this to safely decode received Base64 text from the UI.
6164
## If it fails it will return an empty string.
6265
##
6366
## :str: The string to decode.
6467

65-
$ bindings.decode(cstring str)
68+
var cstr = bindings.decode(cstring str)
69+
result = $cstr
70+
71+
bindings.free(addr cstr)
6672

6773
# ------- Impl funcs --------
6874

0 commit comments

Comments
 (0)