mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 05:06:17 +00:00
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:
parent
613c7ca48f
commit
3570a94a08
|
@ -3,19 +3,11 @@
|
||||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
PLATFORM=$(uname -s | tr A-Z a-z)
|
|
||||||
CUR_DIR=$PWD
|
CUR_DIR=$PWD
|
||||||
WAMR_DIR=$PWD/../../..
|
|
||||||
WAMR_GO_DIR=$PWD/../wamr
|
|
||||||
|
|
||||||
cp -a ${WAMR_DIR}/core/iwasm/include/*.h ${WAMR_GO_DIR}/packaged/include
|
pushd ${CUR_DIR}/.. > /dev/null 2>&1
|
||||||
|
./build.sh
|
||||||
mkdir -p build && cd build
|
popd > /dev/null 2>& 1
|
||||||
cmake ${WAMR_DIR}/product-mini/platforms/${PLATFORM} \
|
|
||||||
-DWAMR_BUILD_LIB_PTHREAD=1 -DWAMR_BUILD_DUMP_CALL_STACK=1 \
|
|
||||||
-DWAMR_BUILD_MEMORY_PROFILING=1
|
|
||||||
make -j ${nproc}
|
|
||||||
cp -a libvmlib.a ${WAMR_GO_DIR}/packaged/lib/${PLATFORM}-amd64
|
|
||||||
|
|
||||||
cd ${CUR_DIR}
|
cd ${CUR_DIR}
|
||||||
rm -f test
|
rm -f test
|
||||||
|
|
|
@ -438,7 +438,7 @@ module_reader_callback(package_type_t module_type, const char *module_name,
|
||||||
const char *format = "%s/%s%s";
|
const char *format = "%s/%s%s";
|
||||||
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
||||||
+ strlen(file_format) + 1;
|
+ strlen(file_format) + 1;
|
||||||
char *wasm_file_name = BH_MALLOC(sz);
|
char *wasm_file_name = wasm_runtime_malloc(sz);
|
||||||
if (!wasm_file_name) {
|
if (!wasm_file_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ module_reader_callback(package_type_t module_type, const char *module_name,
|
||||||
const char *format = "%s/%s%s";
|
const char *format = "%s/%s%s";
|
||||||
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
||||||
+ strlen(file_format) + 1;
|
+ strlen(file_format) + 1;
|
||||||
char *wasm_file_name = BH_MALLOC(sz);
|
char *wasm_file_name = wasm_runtime_malloc(sz);
|
||||||
if (!wasm_file_name) {
|
if (!wasm_file_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,14 +46,14 @@ on_init()
|
||||||
count_label = lv_label_create(NULL, NULL);
|
count_label = lv_label_create(NULL, NULL);
|
||||||
lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
|
lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
|
||||||
|
|
||||||
btn1 = lv_btn_create(
|
/* Create a button on the currently loaded screen */
|
||||||
NULL, NULL); /*Create a button on the currently loaded screen*/
|
btn1 = lv_btn_create(NULL, NULL);
|
||||||
lv_obj_set_event_cb(
|
/* Set function to be called when the button is released */
|
||||||
btn1,
|
lv_obj_set_event_cb(btn1, (lv_event_cb_t)btn_event_cb);
|
||||||
btn_event_cb); /*Set function to be called when the button is released*/
|
/* Align below the label */
|
||||||
lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0); /*Align below the label*/
|
lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
/*Create a label on the button*/
|
/* Create a label on the button */
|
||||||
lv_obj_t *btn_label = lv_label_create(btn1, NULL);
|
lv_obj_t *btn_label = lv_label_create(btn1, NULL);
|
||||||
lv_label_set_text(btn_label, "Click --");
|
lv_label_set_text(btn_label, "Click --");
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ on_init()
|
||||||
lv_label_set_text(label_count1, "100");
|
lv_label_set_text(label_count1, "100");
|
||||||
lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||||
|
|
||||||
/* set up a timer */
|
/* Set up a timer */
|
||||||
user_timer_t timer;
|
user_timer_t timer;
|
||||||
timer = api_timer_create(10, true, false, timer1_update);
|
timer = api_timer_create(10, true, false, timer1_update);
|
||||||
if (timer)
|
if (timer)
|
||||||
|
|
|
@ -46,14 +46,14 @@ on_init()
|
||||||
count_label = lv_label_create(NULL, NULL);
|
count_label = lv_label_create(NULL, NULL);
|
||||||
lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
|
lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
|
||||||
|
|
||||||
btn1 = lv_btn_create(
|
/* Create a button on the current loaded screen */
|
||||||
NULL, NULL); /*Create a button on the currently loaded screen*/
|
btn1 = lv_btn_create(NULL, NULL);
|
||||||
lv_obj_set_event_cb(
|
/* Set function to be called when the button is released */
|
||||||
btn1,
|
lv_obj_set_event_cb(btn1, (lv_event_cb_t)btn_event_cb);
|
||||||
btn_event_cb); /*Set function to be called when the button is released*/
|
/* Align below the label */
|
||||||
lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0); /*Align below the label*/
|
lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
/*Create a label on the button*/
|
/* Create a label on the button */
|
||||||
lv_obj_t *btn_label = lv_label_create(btn1, NULL);
|
lv_obj_t *btn_label = lv_label_create(btn1, NULL);
|
||||||
lv_label_set_text(btn_label, "Click ++");
|
lv_label_set_text(btn_label, "Click ++");
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ on_init()
|
||||||
lv_label_set_text(label_count1, "1");
|
lv_label_set_text(label_count1, "1");
|
||||||
lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||||
|
|
||||||
/* set up a timer */
|
/* Set up a timer */
|
||||||
user_timer_t timer;
|
user_timer_t timer;
|
||||||
timer = api_timer_create(10, true, false, timer1_update);
|
timer = api_timer_create(10, true, false, timer1_update);
|
||||||
if (timer)
|
if (timer)
|
||||||
|
|
|
@ -11,7 +11,7 @@ static bool
|
||||||
module_reader_callback(package_type_t module_type, const char *module_name,
|
module_reader_callback(package_type_t module_type, const char *module_name,
|
||||||
uint8 **p_buffer, uint32 *p_size)
|
uint8 **p_buffer, uint32 *p_size)
|
||||||
{
|
{
|
||||||
char *file_format;
|
char *file_format = NULL;
|
||||||
#if WASM_ENABLE_INTERP != 0
|
#if WASM_ENABLE_INTERP != 0
|
||||||
if (module_type == Wasm_Module_Bytecode)
|
if (module_type == Wasm_Module_Bytecode)
|
||||||
file_format = ".wasm";
|
file_format = ".wasm";
|
||||||
|
@ -21,10 +21,11 @@ module_reader_callback(package_type_t module_type, const char *module_name,
|
||||||
file_format = ".aot";
|
file_format = ".aot";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
bh_assert(file_format != NULL);
|
||||||
const char *format = "%s/%s%s";
|
const char *format = "%s/%s%s";
|
||||||
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
||||||
+ strlen(file_format) + 1;
|
+ strlen(file_format) + 1;
|
||||||
char *wasm_file_name = BH_MALLOC(sz);
|
char *wasm_file_name = wasm_runtime_malloc(sz);
|
||||||
if (!wasm_file_name) {
|
if (!wasm_file_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user