Fix issue with memory allocations in lisp::serialise

Was to do with sv_make.
This commit is contained in:
2025-05-30 08:12:49 +01:00
parent bfff660d0e
commit 4dc3d8f832
3 changed files with 24 additions and 11 deletions

View File

@@ -252,7 +252,13 @@ sv_t serialise(context_t *ctx, lisp_t *ptr)
lmember = CAR(lmember);
sv_t member = serialise(ctx, lmember);
s = sv_concat(&ctx->scratch, s, member);
if (!s.data)
s = member;
else
s = sv_concat(&ctx->scratch, s, member);
// NOTE: eventually this separator we add per item should be mutable at
// runtime.
if (IS_TAG(lsp, CONS) && !CDR(lsp))
continue;
else if (IS_TAG(CDR(lsp), CONS))