From 51a481f6ed9e39b284421778b63b265eca6c1b58 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Thu, 10 Jan 2019 17:23:08 +0100 Subject: Require unique_ptr to Module::addFunctionType() (#1672) This fixes the memory leak in WasmBinaryBuilder::readSignatures() caused probably the exception thrown there before the FunctionType object is safe. This also makes it clear that the Module becomes the owner of the FunctionType objects. --- src/wasm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm.h') diff --git a/src/wasm.h b/src/wasm.h index 27a302d3c..ec8722ad0 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -917,7 +917,7 @@ public: Function* getFunctionOrNull(Name name); Global* getGlobalOrNull(Name name); - void addFunctionType(FunctionType* curr); + FunctionType* addFunctionType(std::unique_ptr curr); void addExport(Export* curr); void addFunction(Function* curr); void addGlobal(Global* curr); -- cgit v1.2.3