out4: ipfix_deinit_collector_array(&(tmp->collector_arr)); out3: ipfix_deinit_sendbuffer(&(tmp->data_sendbuffer)); out2: ipfix_deinit_sendbuffer(&(tmp->template_sendbuffer)); out1: free(tmp);
int ipfix_init_exporter(uint32_t source_id, ipfix_exporter **exporter){	ipfix_exporter *tmp;	int ret;	if(!(tmp=malloc(sizeof(ipfix_exporter)))) {		goto out;	}	tmp->source_id=source_id;	tmp->sequence_number = 0;	tmp->collector_num = 0; // valgrind kindly asked me to inititalize this value JanP	tmp->collector_max_num = 0;	// TODO	// initialize the sendbuffers	ret=ipfix_init_sendbuffer(&(tmp->data_sendbuffer), IPFIX_MAX_SENDBUFSIZE);	if (ret != 0) {		fprintf (stderr, "ipfix_init_exporter : Initializing data sendbuffer failed!\n");		return -1;	}	ret=ipfix_init_sendbuffer(&(tmp->template_sendbuffer), IPFIX_MAX_SENDBUFSIZE);	if (ret != 0) {		fprintf (stderr, "ipfix_init_exporter : Initializing template  sendbuffer failed!\n");		return -1;	}	// intialize the collectors to zero	ret=ipfix_init_collector_array( &(tmp->collector_arr), IPFIX_MAX_COLLECTORS);	if (ret !=0) {		fprintf (stderr, "ipfix_init_exporter: Initializing collectors failed!\n");		return ret;	}	tmp->collector_max_num = IPFIX_MAX_COLLECTORS;	// initialize an array to hold the templates.	// TODO: own function:	ret=ipfix_init_template_array(tmp, IPFIX_MAX_TEMPLATES);	/*   (**exporter).ipfix_lo_template_maxsize  = IPFIX_MAX_TEMPLATES; */	/*   (**exporter).ipfix_lo_template_current_count = 0 ; */	/*   (**exporter).template_arr =  (ipfix_lo_template*) malloc (IPFIX_MAX_TEMPLATES * sizeof(ipfix_lo_template) ); */	// we have not transmitted any templates yet!	tmp->last_template_transmition_time=0;	tmp->template_transmition_timer=IPFIX_DEFAULT_TEMPLATE_TIMER;        /* finally attach new exporter to the pointer we were given */	*exporter=tmp;	return 0;out:	/* we have nothing to free */	return -1;}