hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 36a475c57d23f9b04f9e0a2024d3647419095bf9
parent 1632ae537e6b671d26cde0967ab499da99934483
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date:   Wed, 10 Mar 2021 01:01:57 +0100

fmt: fix memory leak

Diffstat:
Mfmt/fmt.ha | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fmt/fmt.ha b/fmt/fmt.ha @@ -72,7 +72,7 @@ export fn errorfln(fmt: str, args: formattable...) (io::error | size) = export fn asprintf(fmt: str, args: formattable...) str = { let buf = bufio::dynamic(io::mode::WRITE); assert(fprintf(buf, fmt, args...) is size); - return strings::from_utf8_unsafe(bufio::buffer(buf)); + return strings::from_utf8_unsafe(bufio::finish(buf)); }; // Formats text for printing and writes it into a caller supplied buffer. The @@ -126,7 +126,7 @@ export fn errorln(args: formattable...) (io::error | size) = export fn asprint(args: formattable...) str = { let buf = bufio::dynamic(io::mode::WRITE); assert(fprint(buf, args...) is size); - return strings::from_utf8_unsafe(bufio::buffer(buf)); + return strings::from_utf8_unsafe(bufio::finish(buf)); }; // Formats values for printing using the default format modifiers and writes