library/src/events/generic_event_subsystem_helpers/BP-EventDrivenCommandAndControlGenericSessions.cc
// Destroy generic command and control sessions.
Destroy generic command and control sessions.
Destroy generic command and control sessions .
BP_ERROR_T BP_EdcncDestroySession(P_BP_EDCNC_GENERIC_SESSION edcnc_session)
{
	if(!edcnc_session)
		return ERR_FAILURE;
	if(edcnc_session->cc_session)
	{
		BP_DestroyCCSession(edcnc_session->cc_session);
		edcnc_session->cc_session = NULL;
	}
	if(edcnc_session->parsed_config)
	{
		BP_JSONDestroy(edcnc_session->parsed_config);
		edcnc_session->parsed_config = NULL;
	}
	if(edcnc_session->system_hreg)
	{
		BP_DestroyHashTableRegistry(edcnc_session->system_hreg);
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_EdcncDestroySession ( P_BP_EDCNC_GENERIC_SESSION edcnc_session ) { if ( ! edcnc_session ) return ERR_FAILURE ; if ( edcnc_session -> cc_session ) { BP_DestroyCCSession ( edcnc_session -> cc_session ) ; edcnc_session -> cc_session = NULL ; } if ( edcnc_session -> parsed_config ) { BP_JSONDestroy ( edcnc_session -> parsed_config ) ; edcnc_session -> parsed_config = NULL ; } if ( edcnc_session -> system_hreg ) { BP_DestroyHashTableRegistry ( edcnc_session -> system_hreg ) ; } return ERR_SUCCESS ; }
Destroy generic command and control sessions.
Destroy generic command and control sessions .
// ensure we have an edcnc session // if we have a command and control session, destroy it // if we have a parsed json config, destroy it // destroy the system registry (last) // Destroy reg but do not overwrite pointer.  If you overwrite the system_hreg pointer // you will be writing to free'd memory since the registry allocates the structure. // return indicating success