Fix issues reported by Coverity (#2681)

Fix multi-module issues and gui sample issues reported by Coverity.
And refine the build script of go language-binding sample.
This commit is contained in:
Wenyong Huang
2023-10-31 10:48:51 +08:00
committed by GitHub
parent 613c7ca48f
commit 3570a94a08
6 changed files with 24 additions and 31 deletions

View File

@ -11,7 +11,7 @@ static bool
module_reader_callback(package_type_t module_type, const char *module_name,
uint8 **p_buffer, uint32 *p_size)
{
char *file_format;
char *file_format = NULL;
#if WASM_ENABLE_INTERP != 0
if (module_type == Wasm_Module_Bytecode)
file_format = ".wasm";
@ -21,10 +21,11 @@ module_reader_callback(package_type_t module_type, const char *module_name,
file_format = ".aot";
#endif
bh_assert(file_format != NULL);
const char *format = "%s/%s%s";
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
+ strlen(file_format) + 1;
char *wasm_file_name = BH_MALLOC(sz);
char *wasm_file_name = wasm_runtime_malloc(sz);
if (!wasm_file_name) {
return false;
}