| 4620 | } |
| 4621 | |
| 4622 | void |
| 4623 | sctp_clean_up_stream(struct sctp_tcb *stcb, struct sctp_readhead *rh) |
| 4624 | { |
| 4625 | struct sctp_tmit_chunk *chk, *nchk; |
| 4626 | struct sctp_queued_to_read *control, *ncontrol; |
| 4627 | |
| 4628 | TAILQ_FOREACH_SAFE(control, rh, next_instrm, ncontrol) { |
| 4629 | TAILQ_REMOVE(rh, control, next_instrm); |
| 4630 | control->on_strm_q = 0; |
| 4631 | if (control->on_read_q == 0) { |
| 4632 | sctp_free_remote_addr(control->whoFrom); |
| 4633 | if (control->data) { |
| 4634 | sctp_m_freem(control->data); |
| 4635 | control->data = NULL; |
| 4636 | } |
| 4637 | } |
| 4638 | /* Reassembly free? */ |
| 4639 | TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { |
| 4640 | TAILQ_REMOVE(&control->reasm, chk, sctp_next); |
| 4641 | if (chk->data) { |
| 4642 | sctp_m_freem(chk->data); |
| 4643 | chk->data = NULL; |
| 4644 | } |
| 4645 | if (chk->holds_key_ref) |
| 4646 | sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); |
| 4647 | sctp_free_remote_addr(chk->whoTo); |
| 4648 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); |
| 4649 | SCTP_DECR_CHK_COUNT(); |
| 4650 | /* sa_ignore FREED_MEMORY */ |
| 4651 | } |
| 4652 | /* |
| 4653 | * We don't free the address here since all the net's were |
| 4654 | * freed above. |
| 4655 | */ |
| 4656 | if (control->on_read_q == 0) { |
| 4657 | sctp_free_a_readq(stcb, control); |
| 4658 | } |
| 4659 | } |
| 4660 | } |
| 4661 | |
| 4662 | /*- |
| 4663 | * Free the association after un-hashing the remote port. This |
no test coverage detected