Skip to content

Commit

Permalink
Do not leak memory when tun was not created yet
Browse files Browse the repository at this point in the history
Packets pulled off incoming queue should be freed

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
mar-kolya authored and dwmw2 committed May 14, 2017
1 parent 69793ae commit ffee28a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mainloop.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit ffee28a

Please sign in to comment.