diff --git a/wasm2c/wasm-rt-impl-tableops.inc b/wasm2c/wasm-rt-impl-tableops.inc index 323a32f8d..82ff7907b 100644 --- a/wasm2c/wasm-rt-impl-tableops.inc +++ b/wasm2c/wasm-rt-impl-tableops.inc @@ -52,6 +52,9 @@ void WASM_RT_TABLE_APINAME(wasm_rt_allocate)(WASM_RT_TABLE_TYPE* table, table->size = elements; table->max_size = max_elements; table->data = calloc(table->size, sizeof(WASM_RT_TABLE_ELEMENT_TYPE)); + if (table->size != 0 && !table->data) { + abort(); + } } void WASM_RT_TABLE_APINAME(wasm_rt_free)(WASM_RT_TABLE_TYPE* table) {