iter_clear(struct module_qstate* qstate, int id)
{
	struct iter_qstate* iq;
	if(!qstate)
		return;
	iq = (struct iter_qstate*)qstate->minfo[id];
	if(iq) {
		outbound_list_clear(&iq->outlist);
		if(iq->target_count && --iq->target_count[TARGET_COUNT_REF] == 0) {
			free(iq->target_count);
			if(*iq->nxns_dp) free(*iq->nxns_dp);
			free(iq->nxns_dp);
		}
		iq->num_current_queries = 0;
	}
	qstate->minfo[id] = NULL;
}
iter_clear(struct module_qstate* qstate, int id)
{
	struct iter_qstate* iq;
	if(!qstate)
		return;
	iq = (struct iter_qstate*)qstate->minfo[id];
	if(iq) {
		outbound_list_clear(&iq->outlist);
		if(iq->target_count && --iq->target_count[TARGET_COUNT_REF] == 0) {
			free(iq->target_count);
			if(*iq->nxns_dp) free(*iq->nxns_dp);
			free(iq->nxns_dp);
		}
		iq->num_current_queries = 0;
	}
	qstate->minfo[id] = NULL;
}