Can you tell me is there any thing wrong in the code, my application is crashing randomly I cannot find any possible logical or memory error, please help as this is going out of my scope.
#define __FN__ "CGD9_gd_ParseAddFieldsProC"
int CGD9_gd_ParseAddFieldsProC (CGD_gd_ParseAddFields_Iparam_t *i_param_st_p)
{
t_gd9adfld_t *p_ext_fields_s = NULL;
t_gd9sbdat_t *p_buff =
( t_gd9sbdat_t * )( i_param_st_p->i_add_fields_st );
Trace(__FN__);
DEBUG_GD_1("\n\n Function %s - started. \n\n", __FN__);
if(*(i_param_st_p->o_add_fields) == NULL) {
ERR_Report_1(DGD_ERR_IN_FUNCTION,
__FN__ "ERROR - program will crash, input extended struct\
has not been initialized!");
ERR_Report_1(DGD_ERR_IN_FUNCTION, __FN__\
"Check that exit point CMI9_auxc_A_GUIDING_init_forProc \
is used in GD table!");
fflush(NULL);
return FAILURE;
}
p_ext_fields_s = *(i_param_st_p->o_add_fields);
memset ( p_ext_fields_s, ' ', sizeof (t_gd9adfld_t));
/* Copy all extended fields from GD tables to buffer one by one*/
memcpy(&p_ext_fields_s->rowid,
&p_buff[i_param_st_p->output_index].rowid,
sizeof(p_buff[i_param_st_p->output_index].rowid));
memset(p_ext_fields_s->rowid,'0',18);
memcpy(&p_ext_fields_s->l9_legacy_prod_type,
&p_buff[i_param_st_p->output_index].l9_legacy_prod_type,
sizeof(p_ext_fields_s->l9_legacy_prod_type));
/* Free the memory allocated for extended fields */
free(i_param_st_p -> i_add_fields_st);
i_param_st_p -> i_add_fields_st = NULL;
DEBUG_GD_1("\n\n Function %s - completed successuflly. \n\n", __FN__);
return SUCCESS;
}