~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH hare-json] Fix memory leaks

Details
Message ID
<20221230192726.17668-1-vyivel@eclair.cafe>
DKIM signature
missing
Download raw message
Patch: +2 -2
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
---
The ticket that was linked previously appears to be invalid.

 encoding/json/lex.ha   | 1 +
 encoding/json/value.ha | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/encoding/json/lex.ha b/encoding/json/lex.ha
index 06b48aa..b07a8ea 100644
--- a/encoding/json/lex.ha
+++ b/encoding/json/lex.ha
@@ -39,6 +39,7 @@ export fn newlexer(src: io::handle) lexer = {
// Frees state associated with a JSON lexer.
export fn close(lex: *lexer) void = {
	free(lex.buffer);
	io::close(&lex.strbuf)!;
};

// Returns the next token from a JSON lexer. The return value is borrowed from
diff --git a/encoding/json/value.ha b/encoding/json/value.ha
index 2dfcc74..d8dd1f2 100644
--- a/encoding/json/value.ha
+++ b/encoding/json/value.ha
@@ -185,8 +185,7 @@ export fn finish(val: value) void = {
				free(bucket[j].0);
				finish(bucket[j].1);
			};
			// TODO: https://todo.sr.ht/~sircmpwn/hare/690
			//free(bucket);
			free(*bucket);
		};
	case => void;
	};
-- 
2.39.0
Details
Message ID
<CPTO5J0UWA3A.MC56ZF2M415E@taiga>
In-Reply-To
<20221230192726.17668-1-vyivel@eclair.cafe> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/hare-json
   84e6262..  master -> master
Reply to thread Export thread (mbox)