if (bt->dataTemplateDestructionCallbackFunction) bt->dataTemplateDestructionCallbackFunction(sourceId, bt->dataTemplateInfo); free(bt->dataTemplateInfo);
free(bt->dataTemplateInfo->userData);
void destroyBufferedTemplate(SourceID sourceId, TemplateID templateId) {	BufferedTemplate* predecessor = 0;	BufferedTemplate* bt = firstBufferedTemplate;	while (bt != 0) {		if ((bt->sourceID == sourceId) && (bt->templateID == templateId)) break;		predecessor = bt;		bt = (BufferedTemplate*)bt->next;		}	if (bt == 0) return;	if (predecessor != 0) {		predecessor->next = (byte*)bt->next;		} else {		firstBufferedTemplate = (BufferedTemplate*)bt->next;		}	if (bt->setID == IPFIX_SetId_Template) {		free(bt->templateInfo->fieldInfo);		if (bt->templateDestructionCallbackFunction) bt->templateDestructionCallbackFunction(sourceId, bt->templateInfo);		free(bt->templateInfo);		} else	if (bt->setID == IPFIX_SetId_OptionsTemplate) {		free(bt->optionsTemplateInfo->scopeInfo);		free(bt->optionsTemplateInfo->fieldInfo);		if (bt->optionsTemplateDestructionCallbackFunction) bt->optionsTemplateDestructionCallbackFunction(sourceId, bt->optionsTemplateInfo);		free(bt->optionsTemplateInfo);		} else	if (bt->setID == IPFIX_SetId_DataTemplate) {		free(bt->dataTemplateInfo->fieldInfo);		free(bt->dataTemplateInfo->dataInfo);		free(bt->dataTemplateInfo->data);		if (bt->dataTemplateDestructionCallbackFunction) bt->dataTemplateDestructionCallbackFunction(sourceId, bt->dataTemplateInfo);		free(bt->dataTemplateInfo);		} else {		fatal("Unknown template type requested to be freed: %d", bt->setID);		}	free(bt);	}