commit 7109c591a98840fc5804416e9c0978410715e939
parent 56b02405f9b11a3ef74d2ba3e0491173b180018c
Author: Sebastian <sebastian@sebsite.pw>
Date: Thu, 17 Feb 2022 15:14:27 -0500
hex: fix memory leak
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/encoding/hex/hex.ha b/encoding/hex/hex.ha
@@ -50,6 +50,7 @@ export fn decode(s: str) ([]u8 | invalid) = {
let oct = strings::fromutf8_unsafe(s[i * 2..i * 2 + 2]);
let u = match (strconv::stou8b(oct, 16)) {
case (strconv::invalid | strconv::overflow) =>
+ free(buf);
return invalid;
case let u: u8 =>
yield u;