Valgrind detect memleak in OM agent as following:
0x4C2A0F3 malloc valgrind/valgrind-3.13.0/coregrind/m_replacemalloc vg_replace_malloc.c 299 0x714C7C3 ncs_os_task opensaf/src/base os_defs.c 231 0x7156110 ncs_task_create opensaf/src/base sysf_tsk.c 62 0x714BDB7 sysfTmrCreate opensaf/src/base ncssysf_tmr.cc 165 0x7152824 leap_env_init opensaf/src/base sysf_def.c 97 0x7149363 ncs_leap_startup opensaf/src/base ncs_main_pub.c 155 0x7149676 ncs_core_agents_startup opensaf/src/base ncs_main_pub.c 261 0x7149968 ncs_agents_startup opensaf/src/base ncs_main_pub.c 107 0x7831BC4 imma_startup(ncsmds_svc_id) opensaf/src/imm/agent imma_init.cc 281 0x7848FDD initialize_common(unsigned long long*, imma_client_node*, SaVersionT*) opensaf/src/imm/agent imma_om_api.cc 246 0x7849CF9 saImmOmInitialize opensaf/src/imm/agent imma_om_api.cc 228
Proposal fix:
diff --git a/src/base/os_defs.c b/src/base/os_defs.c index fbca376..da38cd7 100644 --- a/src/base/os_defs.c +++ b/src/base/os_defs.c @@ -307,9 +307,11 @@ unsigned int ncs_os_task(NCS_OS_TASK *task, NCS_OS_TASK_REQUEST request) if (pthread_join(*(pthread_t *)task->info.release.i_handle, &status) != 0) { + free(task->info.release.i_handle); return (NCSCC_RC_FAILURE); } + free(task->info.release.i_handle); } break; case NCS_OS_TASK_DETACH: if (pthread_detach(*(pthread_t *)task->info.release.i_handle) !=
Diff: