From 67e63dc611ef92e54e4db10325d2045a255db680 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 24 Jun 2025 13:33:39 -0400 Subject: [PATCH] Multiply stackSize by sizeof stack element --- src/lib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.cpp b/src/lib.cpp index 01c6936..24040f5 100644 --- a/src/lib.cpp +++ b/src/lib.cpp @@ -8,7 +8,7 @@ extern "C" { __attribute__((visibility("default"))) WeaselJsonParser * WeaselJsonParser_create(int stackSize, const WeaselJsonCallbacks *callbacks, void *userdata) { - auto *buf = malloc(sizeof(Parser3) + stackSize); + auto *buf = malloc(sizeof(Parser3) + stackSize * sizeof(*Parser3::stackPtr)); if (buf == nullptr) { return nullptr; }