1

Can anyone plz help? When I was analysing my source code simply via "cppcheck file" it out puts analysis results like

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...

But after I specified some paths via -I like:

cppcheck --force -I<patha> -I<pathb> ... file.c

my leak error is gone:

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...
yunfei
  • 526
  • 2
  • 6
  • 20

1 Answers1

0

I am a Cppcheck developer. This looks very interesting. Is the source code open source?

Daniel Marjamäki
  • 2,907
  • 15
  • 16
  • Hi Daniel, sorry for replying late, I just found your reply recently. I can not find the code now, since time is too long, I hope you have found and resolve this, good luck! – yunfei Dec 08 '16 at 06:18