message: Fix small possible memory leak for WAVM module instantiate failure
diff: @@ -23,10 +23,10 @@ running_instance_context the_running_instance_context;
  class wavm_instantiated_module : public wasm_instantiated_module_interface {
  public:
  - wavm_instantiated_module(ModuleInstance* instance, Module* module, std::vector<uint8_t> initial_mem) :
  + wavm_instantiated_module(ModuleInstance* instance, std::unique_ptr<Module> module, std::vector<uint8_t> initial_mem) :
  _initial_memory(initial_mem),
  _instance(instance),
  - _module(module)
  + _module(std::move(module))
  {}
  void apply(apply_context& context) override {
  @@ -37,11 +37,6 @@ class wavm_instantiated_module : public wasm_instantiated_module_interface {
  call("apply", args, context);
  }
  - ~wavm_instantiated_module() {
  - delete _module;
  - //_instance is deleted via WAVM's object garbage collection when wavm_rutime is deleted
  - }
  -
  private:
  void call(const string &entry_point, const vector <Value> &args, apply_context &context) {
  try {
  @@ -80,9 +75,10 @@ class wavm_instantiated_module : public wasm_instantiated_module_interface {
  std::vector<uint8_t> _initial_memory;
  - //naked pointers because ModuleInstance is opaque
  + //naked pointer because ModuleInstance is opaque
  + //_instance is deleted via WAVM's object garbage collection when wavm_rutime is deleted
  ModuleInstance* _instance;
  - Module* _module;
  + std::unique_ptr<Module> _module;
  };
  @@ -113,7 +109,7 @@ wavm_runtime::~wavm_runtime() {
  }
  std::unique_ptr<wasm_instantiated_module_interface> wavm_runtime::instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t> initial_memory) {
  - Module* module = new Module();
  + std::unique_ptr<Module> module = std::make_unique<Module>();
  try {
  Serialization::MemoryInputStream stream((const U8*)code_bytes, code_size);
  WASM::serialize(stream, *module);
  @@ -126,7 +122,7 @@ std::unique_ptr<wasm_instantiated_module_interface> wavm_runtime::instantiate_mo
  ModuleInstance *instance = instantiateModule(*module, std::move(link_result.resolvedImports));
  FC_ASSERT(instance != nullptr);
  - return std::make_unique<wavm_instantiated_module>(instance, module, initial_memory);
  + return std::make_unique<wavm_instantiated_module>(instance, std::move(module), initial_memory);
  }
  }}}}
  