Пример #1
0
/**
 * This function destroys the DNS layer as well.
 * If the (custom) DNS layer has no destructor,
 * then this cannot and does not destroy it.
 */
void
SPF_server_free(SPF_server_t *sp)
{
	if (sp->resolver && sp->destroy_resolver)
		SPF_dns_free(sp->resolver);
	if (sp->local_policy)
		SPF_record_free(sp->local_policy);
	if (sp->explanation)
		SPF_macro_free(sp->explanation);
	if (sp->rec_dom)
		free(sp->rec_dom);
	/* XXX TODO: Free other parts of the structure. */
	free(sp);
}
Пример #2
0
void
SPF_dns_free(SPF_dns_server_t *spf_dns_server)
{
	SPF_dns_server_t	*layer_below;

	SPF_ASSERT_NOTNULL(spf_dns_server);
	// SPF_ASSERT_NOTNULL(spf_dns_server->destroy);
	layer_below = spf_dns_server->layer_below;

	/* If this is not set, we assume someone else knows, and will destroy it. */
	if (spf_dns_server->destroy) {
		spf_dns_server->destroy(spf_dns_server);
		if (layer_below != NULL)
			SPF_dns_free(layer_below);
	}
}