From: Nikolay Martynov Date: Thu, 11 May 2017 03:02:58 +0000 (-0400) Subject: Do not leak memory when tun was not created yet X-Git-Tag: v8.00~171 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ffee28a178efae4c27f997337fabd26fcffd2f8b;p=users%2Fdwmw2%2Fopenconnect.git Do not leak memory when tun was not created yet Packets pulled off incoming queue should be freed Signed-off-by: Nikolay Martynov Signed-off-by: David Woodhouse --- diff --git a/mainloop.c b/mainloop.c index efe493a1..cc80d0e2 100644 --- a/mainloop.c +++ b/mainloop.c @@ -51,8 +51,10 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout) int work_done = 0; if (!tun_is_up(vpninfo)) { - /* no tun yet, clear any queued packets */ - while ((this = dequeue_packet(&vpninfo->incoming_queue))); + /* no tun yet; clear any queued packets */ + while ((this = dequeue_packet(&vpninfo->incoming_queue))) + free(this); + return 0; }