Fix memory leak on handled packets
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 28 Jan 2009 22:47:48 +0000 (09:47 +1100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 28 Jan 2009 22:47:48 +0000 (09:47 +1100)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
dtls.c
tun.c

diff --git a/dtls.c b/dtls.c
index 002ee16..898b30e 100644 (file)
--- a/dtls.c
+++ b/dtls.c
@@ -473,6 +473,7 @@ int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout)
                vpninfo->progress(vpninfo, PRG_TRACE,
                                  "Sent DTLS packet of %d bytes; SSL_write() returned %d\n",
                                  this->len, ret);
+               free(this);
        }
 
        return work_done;
diff --git a/tun.c b/tun.c
index a84f89d..84f6ac6 100644 (file)
--- a/tun.c
+++ b/tun.c
@@ -335,6 +335,7 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout)
                        vpninfo->quit_reason = "Client connection terminated";
                        return 1;
                }
+               free(this);
        }
        /* Work is not done if we just got rid of packets off the queue */
        return work_done;