[PATCH 1/3] Do not leak memory when tun was not created yet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Packets pulled off incoming queue should be freed

Signed-off-by: Nikolay Martynov <mar.kolya at gmail.com>
---
 mainloop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mainloop.c b/mainloop.c
index efe493a..e8e9a78 100644
--- a/mainloop.c
+++ b/mainloop.c
@@ -52,7 +52,9 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout)
 
 	if (!tun_is_up(vpninfo)) {
 		/* no tun yet, clear any queued packets */
-		while ((this = dequeue_packet(&vpninfo->incoming_queue)));
+		while ((this = dequeue_packet(&vpninfo->incoming_queue))) {
+			free(this);
+		}
 		return 0;
 	}
 
-- 
2.11.0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux