From e4a67dea379147cc53c8da983f9c4b86d4fd9cc2 Mon Sep 17 00:00:00 2001 From: Lukas Neubert Date: Wed, 17 Feb 2021 01:19:26 +0100 Subject: [PATCH] json2: wrap Builder.free() calls inside unsafe (#8790) --- vlib/x/json2/decoder.v | 2 +- vlib/x/json2/encoder.v | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/x/json2/decoder.v b/vlib/x/json2/decoder.v index f06ecabdce..1c749f06b0 100644 --- a/vlib/x/json2/decoder.v +++ b/vlib/x/json2/decoder.v @@ -311,7 +311,7 @@ fn (mut p Parser) decode_string() ?Any { } p.next() defer { - strwr.free() + unsafe { strwr.free() } } str := strwr.str() return Any(str) diff --git a/vlib/x/json2/encoder.v b/vlib/x/json2/encoder.v index f107d5dd36..c929c7e160 100644 --- a/vlib/x/json2/encoder.v +++ b/vlib/x/json2/encoder.v @@ -30,7 +30,7 @@ pub fn (flds map[string]Any) str() string { } wr.write_b(`}`) defer { - wr.free() + unsafe { wr.free() } } res := wr.str() return res @@ -45,7 +45,7 @@ pub fn (flds []Any) str() string { } wr.write_b(`]`) defer { - wr.free() + unsafe { wr.free() } } res := wr.str() return res