wasm: release buffer if error occurred
@@ -70,6 +70,9 @@ static int flb_wasm_load_wasm_binary(const char *wasm_path, int8_t **out_buf, ui
return buffer != NULL;
error:
+ if (buffer != NULL) {
+ BH_FREE(buffer);
+ }
return FLB_FALSE;
}
@@ -106,6 +109,7 @@ struct flb_wasm *flb_wasm_instantiate(struct flb_config *config, const char *was
wasi_dir_list = flb_malloc(sizeof(char *) * accessible_dir_list_size);
if (!wasi_dir_list) {
flb_errno();
+ flb_free(fw);
return NULL;
}
mk_list_foreach(head, accessible_dir_list) {
