sofree(struct socket *so)

{

  Slirp *slirp = so->slirp;

  struct mbuf *ifm;



  for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;

       (struct quehead *) ifm != &slirp->if_fastq;

       ifm = ifm->ifq_next) {

    if (ifm->ifq_so == so) {

      ifm->ifq_so = NULL;





  for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;

       (struct quehead *) ifm != &slirp->if_batchq;

       ifm = ifm->ifq_next) {

    if (ifm->ifq_so == so) {

      ifm->ifq_so = NULL;





  if (so->so_emu==EMU_RSH && so->extra) {

	sofree(so->extra);

	so->extra=NULL;


  if (so == slirp->tcp_last_so) {

      slirp->tcp_last_so = &slirp->tcb;

  } else if (so == slirp->udp_last_so) {

      slirp->udp_last_so = &slirp->udb;

  } else if (so == slirp->icmp_last_so) {

      slirp->icmp_last_so = &slirp->icmp;


  m_free(so->so_m);



  if(so->so_next && so->so_prev)

    remque(so);  /* crashes if so is not in a queue */






  free(so);

sofree(struct socket *so)

{

  Slirp *slirp = so->slirp;

  struct mbuf *ifm;



  for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;

       (struct quehead *) ifm != &slirp->if_fastq;

       ifm = ifm->ifq_next) {

    if (ifm->ifq_so == so) {

      ifm->ifq_so = NULL;





  for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;

       (struct quehead *) ifm != &slirp->if_batchq;

       ifm = ifm->ifq_next) {

    if (ifm->ifq_so == so) {

      ifm->ifq_so = NULL;





  if (so->so_emu==EMU_RSH && so->extra) {

	sofree(so->extra);

	so->extra=NULL;


  if (so == slirp->tcp_last_so) {

      slirp->tcp_last_so = &slirp->tcb;

  } else if (so == slirp->udp_last_so) {

      slirp->udp_last_so = &slirp->udb;

  } else if (so == slirp->icmp_last_so) {

      slirp->icmp_last_so = &slirp->icmp;


  m_free(so->so_m);



  if(so->so_next && so->so_prev)

    remque(so);  






  free(so);

FUNC_0(struct socket *VAR_0)

{

  Slirp *slirp = VAR_0->slirp;

  struct mbuf *VAR_1;



  for (VAR_1 = (struct mbuf *) slirp->if_fastq.qh_link;

       (struct quehead *) VAR_1 != &slirp->if_fastq;

       VAR_1 = VAR_1->ifq_next) {

    if (VAR_1->ifq_so == VAR_0) {

      VAR_1->ifq_so = NULL;





  for (VAR_1 = (struct mbuf *) slirp->if_batchq.qh_link;

       (struct quehead *) VAR_1 != &slirp->if_batchq;

       VAR_1 = VAR_1->ifq_next) {

    if (VAR_1->ifq_so == VAR_0) {

      VAR_1->ifq_so = NULL;





  if (VAR_0->so_emu==EMU_RSH && VAR_0->extra) {

	FUNC_0(VAR_0->extra);

	VAR_0->extra=NULL;


  if (VAR_0 == slirp->tcp_last_so) {

      slirp->tcp_last_so = &slirp->tcb;

  } else if (VAR_0 == slirp->udp_last_so) {

      slirp->udp_last_so = &slirp->udb;

  } else if (VAR_0 == slirp->icmp_last_so) {

      slirp->icmp_last_so = &slirp->icmp;


  m_free(VAR_0->so_m);



  if(VAR_0->so_next && VAR_0->so_prev)

    remque(VAR_0);  






  free(VAR_0);

FUNC_0(struct socket *VAR_0)
{ Slirp *slirp = VAR_0->slirp; struct mbuf *VAR_1; for (VAR_1 = (struct mbuf *) slirp->if_fastq.qh_link; (struct quehead *) VAR_1 != &slirp->if_fastq; VAR_1 = VAR_1->ifq_next) { if (VAR_1->ifq_so == VAR_0) { VAR_1->ifq_so = NULL; for (VAR_1 = (struct mbuf *) slirp->if_batchq.qh_link; (struct quehead *) VAR_1 != &slirp->if_batchq; VAR_1 = VAR_1->ifq_next) { if (VAR_1->ifq_so == VAR_0) { VAR_1->ifq_so = NULL; if (VAR_0->so_emu==EMU_RSH && VAR_0->extra) { FUNC_0(VAR_0->extra); VAR_0->extra=NULL; if (VAR_0 == slirp->tcp_last_so) { slirp->tcp_last_so = &slirp->tcb; } else if (VAR_0 == slirp->udp_last_so) { slirp->udp_last_so = &slirp->udb; } else if (VAR_0 == slirp->icmp_last_so) { slirp->icmp_last_so = &slirp->icmp; m_free(VAR_0->so_m); if(VAR_0->so_next && VAR_0->so_prev)
remque(VAR_0); free(VAR_0);