Multiply stackSize by sizeof stack element

This commit is contained in:
2025-06-24 13:33:39 -04:00
parent 9319076b44
commit 67e63dc611

View File

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