PPP, PPPoS: fix memory leak when disconnecting if there are remaining input bytes

Art says:
  pppos_input() can call ppp_input() which can call pppos_disconnect() to
  disconnect the interface.  However, it will continue to read in
  characters and allocate a pbuf from the PBUF_POOL and keep it in
  pppos->in_head and in_tail. When a re-connect happens and pppos_connect()
  is called, this pppos->in_head and in_tail are zeroed, hence a memory
  leak. (This happens with PPP_INPROC_IRQ_SAFE not defined.)

  A fix would be inside pppos_input() to break out of the loop inputting
  characters after calling ppp_input() if pppos->open == 0.  Note that
  the loop is not even entered if pppos->open == 0.

          ppp_input(ppp, inp);
          if(pppos->open == 0) //get out if they disconnected
            break;

Fix it in a similar way which doesn't add new code by moving the
existing pppos->open check inside the byte loop.
1 file changed