This article describes how to debug memory corruption and or memory Invalid Read with help of Valgrind.
For more reference related to valgrind follow the link: Valgrind Tutorial
In order to run the netconfd-pro with valgrind run it as follows:
valgrind -v --leak-check=full --show-leak-kinds=all netconfd-pro …
After you started the server with valgrind, run the operation that is causing memory issue or perform some action that cause malfunction(s) and then shut down the server, simple Ctrl+C the process in the terminal where you started it.
The summary after the shut down may look as follows:
agt_acm: Clearing context cache agt_ncx: Start unregister RPC callbacks agt_not: cleaning stream 'NETCONF' ncx: Clear Mod load callback (slot 2) ncx: Clear Mod load callback (slot 1) agt_nmda: disabled, skipping cleanup phase ncx: Clear Mod load callback (slot 0) ==3297== ==3297== HEAP SUMMARY: ==3297== in use at exit: 32 bytes in 1 blocks ==3297== total heap usage: 53,254 allocs, 53,253 frees, 90,476,358 bytes allocated ==3297== ==3297== Searching for pointers to 1 not-freed blocks ==3297== Checked 879,624 bytes ==3297== ==3297== 32 bytes in 1 blocks are still reachable in loss record 1 of 1 ==3297== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==3297== by 0x68A37F4: _dlerror_run (dlerror.c:140) ==3297== by 0x68A3050: dlopen@@GLIBC_2.2.5 (dlopen.c:87) ==3297== by 0x4F207BF: agt_load_sil_code (agt_sil_lib.c:498) ==3297== by 0x4F20227: load_SIL_loadpath (agt_sil_lib.c:301) ==3297== by 0x4F2019F: load_SIL (agt_sil_lib.c:264) ==3297== by 0x4F048C1: agt_init2_ex (agt.c:3815) ==3297== by 0x10AC75: cmn_init (netconfd.c:335) ==3297== by 0x10B188: main (netconfd_main.c:191) ==3297== ==3297== LEAK SUMMARY: ==3297== definitely lost: 0 bytes in 0 blocks ==3297== indirectly lost: 0 bytes in 0 blocks ==3297== possibly lost: 0 bytes in 0 blocks ==3297== still reachable: 32 bytes in 1 blocks ==3297== suppressed: 0 bytes in 0 blocks ==3297== ==3297== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==3297== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
NOTE that the ERROR SUMMARY does not contain any errors.The dlopen problem is known issue and is not related to the netconfd-pro.