任何人都可以帮助吗? 当我通过简单分析我的源代码时 “cppcheck文件”它将分析结果如
Checking ../bst_hal/daemon_rls/src/event_handler.c...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_ARCH_ARM...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_ARCH_ARM;CFG_HANDLE_FAULT_SIG...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_CHECK_DISPLAY_STATE...
**[../bst_hal/daemon_rls/src/event_handler.c:236]: (error) Resource leak: fd_w**
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_CHECK_DISPLAY_STATE;CFG_SENSORD_SIMU...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_DISCARD_OLD_CMD...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_HANDLE_FAULT_SIG...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_SENSORD_SIMU...
但在我通过-I之后指定了一些路径:
cppcheck --force -I<patha> -I<pathb> ... file.c
我的泄漏错误消失了:
Checking ../bst_hal/daemon_rls/src/event_handler.c...
Checking ../bst_hal/daemon_rls/src/event_handler.c: ARRAY_SIZE...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_ARCH_ARM...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_CHECK_DISPLAY_STATE...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_CHECK_DISPLAY_STATE;CFG_SENSORD_SIMU...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_DATA_INPUT_SRC_FILE...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_LOG_TO_LOGCAT...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_LOG_WITH_TIME...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_SENSORD_SIMU...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_SENSOR_G_EMU...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_TARGET_OS_ANDROID...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_TARGET_OS_LINUX...
Checking ../bst_hal/daemon_rls/src/event_handler.c: CONTAINER_OF...
Checking ../bst_hal/daemon_rls/src/event_handler.c: OFFSET_OF...
答案 0 :(得分:0)
我是Cppcheck开发人员。这看起来很有趣。源代码是开源的吗?