Fix issues detected by Coverity (#1776)

- wasm_func_call always return trap if failed
- in Debug, always run LEAK_TEST in samples/wasm-c-api
This commit is contained in:
liang.he
2022-12-01 22:03:09 +08:00
committed by GitHub
parent 1652f22a77
commit fc8f70cfa4
14 changed files with 143 additions and 66 deletions

View File

@ -199,11 +199,16 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if(VALGRIND)
foreach(EX ${EXAMPLES})
add_custom_target(${EX}_LEAK_TEST
COMMAND ${VALGRIND} --tool=memcheck --leak-check=yes ./${EX}
add_custom_command(
OUTPUT ${EX}_leak_check.report
DEPENDS ${EX} ${EX}_WASM
VERBATIM
COMMENT "run a leak check on ${EX}"
COMMAND ${VALGRIND} --tool=memcheck --leak-check=summary -- ./${EX} > ${EX}_leak_check.report 2>&1
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target(${EX}_LEAK_TEST ALL
DEPENDS ${EX}_leak_check.report
COMMAND grep "All heap blocks were freed -- no leaks are possible" ${EX}_leak_check.report
COMMENT "Please read ${EX}_leak_check.report when meeting Error"
)
endforeach()
endif (VALGRIND)