ipfix_unlock_mutex (tmp, EXPORTER);
int ipfix_init_exporter(uint32_t source_id, ipfix_exporter **exporter){	ipfix_exporter *tmp;	int ret;	if(!(tmp=malloc(sizeof(ipfix_exporter)))) {		goto out;	}#ifdef IPFIX_THREADED	// init all mutexes	pthread_mutex_init(&(tmp->exporter_mutex), NULL);	pthread_mutex_init(&(tmp->data_sendbuffer_mutex), NULL);	pthread_mutex_init(&(tmp->template_sendbuffer_mutex), NULL);	pthread_mutex_init(&(tmp->collector_array_mutex), NULL);#endif	// obtain a lock on this object	ret = ipfix_lock_mutex (tmp, EXPORTER);	// FIXME: maybe, we need yet another target than out	if (ret != 0) goto out; 		DPRINTF ("ipfix_init_exporter locked exporter\n");		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");		goto out1;	}	ret=ipfix_init_sendbuffer(&(tmp->template_sendbuffer), IPFIX_MAX_SENDBUFSIZE);	if (ret != 0) {		fprintf (stderr, "ipfix_init_exporter : Initializing template  sendbuffer failed!\n");		goto out2;	}	// 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");		goto out3;	}	tmp->collector_max_num = IPFIX_MAX_COLLECTORS;	// initialize an array to hold the templates.	// TODO: own function:        if(ipfix_init_template_array(tmp, IPFIX_MAX_TEMPLATES)) {		goto out4;        }	/*   (**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;out4:        ipfix_deinit_collector_array(&(tmp->collector_arr));out3:        ipfix_deinit_sendbuffer(&(tmp->data_sendbuffer));out2:        ipfix_deinit_sendbuffer(&(tmp->template_sendbuffer));out1:	ipfix_unlock_mutex (tmp, EXPORTER);        free(tmp);out:	/* we have nothing to free */	return -1;}