[wasm-shape] Minor conditionalize allocation
This commit is contained in:
parent
196c6b6c1f
commit
7b1c5e86ae
|
@ -336,9 +336,9 @@ retry:
|
|||
arguments[2].kind = WASM_I32;
|
||||
arguments[2].of.i32 = bufferref;
|
||||
arguments[3].kind = WASM_I32;
|
||||
arguments[3].of.i32 = wasm_runtime_module_dup_data (module_inst,
|
||||
(const char *) features,
|
||||
num_features * sizeof (features[0]));
|
||||
arguments[3].of.i32 = num_features ? wasm_runtime_module_dup_data (module_inst,
|
||||
(const char *) features,
|
||||
num_features * sizeof (features[0])) : 0;
|
||||
arguments[4].kind = WASM_I32;
|
||||
arguments[4].of.i32 = num_features;
|
||||
|
||||
|
@ -346,7 +346,8 @@ retry:
|
|||
ARRAY_LENGTH (results), results,
|
||||
ARRAY_LENGTH (arguments), arguments);
|
||||
|
||||
wasm_runtime_module_free (module_inst, arguments[2].of.i32);
|
||||
if (num_features)
|
||||
wasm_runtime_module_free (module_inst, arguments[2].of.i32);
|
||||
|
||||
if (unlikely (!ret || !results[0].of.i32))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue