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; }