net: ip: Fix 6lo buffer leak when sending ACK
net: ip: Fix 6lo buffer leak when sending ACK

Due to recent TCP fixes for 6lo, we are making a copy of buffers
sent to net_tcp_send_buf() so that TCP retransmit can send the original
(unmodified) buffer.  This original buffer is freed via the TCP
sent_list when the related ACK packet is received.

However, there are users of the net_tcp_send_buf() function which
will never get a corresponding ACK (and do not add the buffer to the
TCP sent_list).  An example is send_ack() in net_context.c.  In this
case, we leak the original buffer.

To fix this leak in the 6lo specific block of net_tcp_send_buf(),
let's check to see if the original buffer was added to the TCP sent_list
and if not, then avoid the buffer copy process entirely.

Change-Id: If99e0e5bf266d33dd3466dc5d74443eaa39d10a8
Signed-off-by: Michael Scott <087571639a1dbb4ff1803c64e3643475ba482686@linaro.org>

rsalveti/zephyr,fractalclone/zephyr-riscv,erwango/zephyr,punitvara/zephyr,ldts/zephyr,bboozzoo/zephyr,fbsder/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,explora26/zephyr,bigdinotech/zephyr,nashif/zephyr,Vudentz/zephyr,Vudentz/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,kraj/zephyr,kraj/zephyr,galak/zephyr,GiulianoFranchetto/zephyr,galak/zephyr,runchip/zephyr-cc3220,rsalveti/zephyr,zephyriot/zephyr,explora26/zephyr,holtmann/zephyr,ldts/zephyr,runchip/zephyr-cc3220,galak/zephyr,punitvara/zephyr,ldts/zephyr,kraj/zephyr,bboozzoo/zephyr,fbsder/zephyr,fractalclone/zephyr-riscv,aceofall/zephyr-iotos,mbolivar/zephyr,GiulianoFranchetto/zephyr,finikorg/zephyr,runchip/zephyr-cc3220,runchip/zephyr-cc3200,nashif/zephyr,fractalclone/zephyr-riscv,zephyrproject-rtos/zephyr,explora26/zephyr,holtmann/zephyr,bboozzoo/zephyr,bigdinotech/zephyr,runchip/zephyr-cc3200,nashif/zephyr,fbsder/zephyr,runchip/zephyr-cc3200,zephyrproject-rtos/zephyr,pklazy/zephyr,erwango/zephyr,pklazy/zephyr,nashif/zephyr,pklazy/zephyr,punitvara/zephyr,bigdinotech/zephyr,zephyriot/zephyr,rsalveti/zephyr,runchip/zephyr-cc3200,explora26/zephyr,mbolivar/zephyr,galak/zephyr,sharronliu/zephyr,ldts/zephyr,GiulianoFranchetto/zephyr,aceofall/zephyr-iotos,Vudentz/zephyr,Vudentz/zephyr,erwango/zephyr,Vudentz/zephyr,finikorg/zephyr,Vudentz/zephyr,sharronliu/zephyr,ldts/zephyr,bigdinotech/zephyr,bboozzoo/zephyr,rsalveti/zephyr,galak/zephyr,pklazy/zephyr,pklazy/zephyr,zephyrproject-rtos/zephyr,sharronliu/zephyr,runchip/zephyr-cc3220,fbsder/zephyr,punitvara/zephyr,zephyriot/zephyr,finikorg/zephyr,fractalclone/zephyr-riscv,explora26/zephyr,bigdinotech/zephyr,kraj/zephyr,runchip/zephyr-cc3200,zephyrproject-rtos/zephyr,holtmann/zephyr,aceofall/zephyr-iotos,bboozzoo/zephyr,holtmann/zephyr,nashif/zephyr,zephyriot/zephyr,fbsder/zephyr,sharronliu/zephyr,holtmann/zephyr,aceofall/zephyr-iotos,aceofall/zephyr-iotos,fractalclone/zephyr-riscv,rsalveti/zephyr,sharronliu/zephyr,mbolivar/zephyr,erwango/zephyr,erwango/zephyr,GiulianoFranchetto/zephyr,zephyriot/zephyr,kraj/zephyr,mbolivar/zephyr,runchip/zephyr-cc3220,finikorg/zephyr,mbolivar/zephyr