]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Add alloc_pkt() and free_pkt() helpers
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 28 Jun 2021 11:54:53 +0000 (12:54 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 28 Jun 2021 15:47:47 +0000 (16:47 +0100)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
12 files changed:
array.c
cstp.c
dtls.c
esp.c
gpst.c
library.c
mainloop.c
oncp.c
openconnect-internal.h
ppp.c
pulse.c
ssl.c

diff --git a/array.c b/array.c
index 736e0f8ce192f8e0325c4f8adfce1ff1fc2d3a75..1aba7bda37c185c0e6cd932e726220b265d7e67b 100644 (file)
--- a/array.c
+++ b/array.c
@@ -791,7 +791,7 @@ int array_connect(struct openconnect_info *vpninfo)
        }
        buf_free(reqbuf);
 
-       free(vpninfo->cstp_pkt);
+       free_pkt(vpninfo, vpninfo->cstp_pkt);
        vpninfo->cstp_pkt = NULL;
 
        vpninfo->ip_info.mtu = 1400;
@@ -821,7 +821,7 @@ int array_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                int len;
 
                if (!vpninfo->cstp_pkt) {
-                       vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                       vpninfo->cstp_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!vpninfo->cstp_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -908,7 +908,7 @@ int array_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                /* Don't free the 'special' packets */
                if (vpninfo->current_ssl_pkt != &dpd_pkt &&
                    vpninfo->current_ssl_pkt != &nodtls_pkt)
-                       free(vpninfo->current_ssl_pkt);
+                       free_pkt(vpninfo, vpninfo->current_ssl_pkt);
 
                vpninfo->current_ssl_pkt = NULL;
        }
@@ -1056,7 +1056,7 @@ int array_dtls_mainloop(struct openconnect_info *vpninfo, int *timeout, int read
                         * may be in active use while we attempt to connect DTLS.
                         * So use vpninfo->dtls_pkt for this. */
                        if (!vpninfo->dtls_pkt)
-                               vpninfo->dtls_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                               vpninfo->dtls_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!vpninfo->dtls_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                dtls_close(vpninfo);
@@ -1166,7 +1166,7 @@ int array_dtls_mainloop(struct openconnect_info *vpninfo, int *timeout, int read
                unsigned char *buf;
 
                if (!vpninfo->dtls_pkt) {
-                       vpninfo->dtls_pkt = malloc(sizeof(struct pkt) + len);
+                       vpninfo->dtls_pkt = alloc_pkt(vpninfo, len);
                        if (!vpninfo->dtls_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -1277,7 +1277,7 @@ int array_dtls_mainloop(struct openconnect_info *vpninfo, int *timeout, int read
                vpn_progress(vpninfo, PRG_TRACE,
                             _("Sent DTLS packet of %d bytes; DTLS send returned %d\n"),
                             this->len, ret);
-               free(this);
+               free_pkt(vpninfo, this);
        }
 
        return work_done;
diff --git a/cstp.c b/cstp.c
index 7e7916a651a950b82c585d712eb6a8ba14f9dd7f..6582097ad45ad3dd5dbbc7b84fb1713f2ab059a5 100644 (file)
--- a/cstp.c
+++ b/cstp.c
@@ -715,8 +715,8 @@ int cstp_connect(struct openconnect_info *vpninfo)
 
        /* If *any* compression is enabled, we'll need a deflate_pkt to compress into */
        if (deflate_bufsize > vpninfo->deflate_pkt_size) {
-               free(vpninfo->deflate_pkt);
-               vpninfo->deflate_pkt = malloc(sizeof(struct pkt) + deflate_bufsize);
+               free_pkt(vpninfo, vpninfo->deflate_pkt);
+               vpninfo->deflate_pkt = alloc_pkt(vpninfo, deflate_bufsize);
                if (!vpninfo->deflate_pkt) {
                        vpninfo->deflate_pkt_size = 0;
                        vpn_progress(vpninfo, PRG_ERR,
@@ -921,7 +921,7 @@ int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                int len, payload_len;
 
                if (!vpninfo->cstp_pkt) {
-                       vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                       vpninfo->cstp_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!vpninfo->cstp_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -1071,12 +1071,12 @@ int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                }
                /* Don't free the 'special' packets */
                if (vpninfo->current_ssl_pkt == vpninfo->deflate_pkt) {
-                       free(vpninfo->pending_deflated_pkt);
+                       free_pkt(vpninfo, vpninfo->pending_deflated_pkt);
                        vpninfo->pending_deflated_pkt = NULL;
                } else if (vpninfo->current_ssl_pkt != &dpd_pkt &&
                         vpninfo->current_ssl_pkt != &dpd_resp_pkt &&
                         vpninfo->current_ssl_pkt != &keepalive_pkt)
-                       free(vpninfo->current_ssl_pkt);
+                       free_pkt(vpninfo, vpninfo->current_ssl_pkt);
 
                vpninfo->current_ssl_pkt = NULL;
        }
diff --git a/dtls.c b/dtls.c
index 310969e1ff8567e9a9c0bd791aa92b266b63aed1..389bd0d067b97503ee6733c1ee582412cf44d4db 100644 (file)
--- a/dtls.c
+++ b/dtls.c
@@ -275,7 +275,7 @@ int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                unsigned char *buf;
 
                if (!vpninfo->dtls_pkt) {
-                       vpninfo->dtls_pkt = malloc(sizeof(struct pkt) + len);
+                       vpninfo->dtls_pkt = alloc_pkt(vpninfo, len);
                        if (!vpninfo->dtls_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -448,7 +448,7 @@ int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                vpn_progress(vpninfo, PRG_TRACE,
                             _("Sent DTLS packet of %d bytes; DTLS send returned %d\n"),
                             this->len, ret);
-               free(this);
+               free_pkt(vpninfo, this);
        }
 
        return work_done;
diff --git a/esp.c b/esp.c
index e5230c283430b197017b3b559b93d10e47b64c4e..72151cd690f2259b9d658ef5b8fd877322b026d8 100644 (file)
--- a/esp.c
+++ b/esp.c
@@ -156,7 +156,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                struct pkt *pkt;
 
                if (!vpninfo->dtls_pkt) {
-                       vpninfo->dtls_pkt = malloc(sizeof(struct pkt) + len);
+                       vpninfo->dtls_pkt = alloc_pkt(vpninfo, len);
                        if (!vpninfo->dtls_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -244,7 +244,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        }
                }
                if (pkt->data[len - 1] == 0x05) {
-                       struct pkt *newpkt = malloc(sizeof(*pkt) + receive_mtu + vpninfo->pkt_trailer);
+                       struct pkt *newpkt = alloc_pkt(vpninfo, receive_mtu + vpninfo->pkt_trailer);
                        int newlen = receive_mtu;
                        if (!newpkt) {
                                vpn_progress(vpninfo, PRG_ERR,
@@ -255,7 +255,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                                            pkt->data, &pkt->len) || pkt->len) {
                                vpn_progress(vpninfo, PRG_ERR,
                                             _("LZO decompression of ESP packet failed\n"));
-                               free(newpkt);
+                               free_pkt(vpninfo, newpkt);
                                continue;
                        }
                        newpkt->len = receive_mtu - newlen;
@@ -344,7 +344,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        len = construct_esp_packet(vpninfo, this, 0);
                        if (len < 0) {
                                /* Should we disable ESP? */
-                               free(this);
+                               free_pkt(vpninfo, this);
                                work_done = 1;
                                continue;
                        }
@@ -378,7 +378,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        unmonitor_write_fd(vpninfo, dtls);
                        vpninfo->deflate_pkt = NULL;
                }
-               free(this);
+               free_pkt(vpninfo, this);
                work_done = 1;
        }
 
@@ -399,7 +399,7 @@ void esp_close(struct openconnect_info *vpninfo)
        if (vpninfo->dtls_state > DTLS_DISABLED)
                vpninfo->dtls_state = DTLS_SLEEPING;
        if (vpninfo->deflate_pkt) {
-               free(vpninfo->deflate_pkt);
+               free_pkt(vpninfo, vpninfo->deflate_pkt);
                vpninfo->deflate_pkt = NULL;
        }
 }
diff --git a/gpst.c b/gpst.c
index 72ee1fc69673d48df9dbaee7d455bdf4d8a17880..fd44f23b7b67727a07e869bea651688db207c075 100644 (file)
--- a/gpst.c
+++ b/gpst.c
@@ -1128,7 +1128,7 @@ int gpst_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                int len, payload_len;
 
                if (!vpninfo->cstp_pkt) {
-                       vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                       vpninfo->cstp_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!vpninfo->cstp_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -1239,7 +1239,7 @@ int gpst_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                }
                /* Don't free the 'special' packets */
                if (vpninfo->current_ssl_pkt != &dpd_pkt)
-                       free(vpninfo->current_ssl_pkt);
+                       free_pkt(vpninfo, vpninfo->current_ssl_pkt);
 
                vpninfo->current_ssl_pkt = NULL;
        }
@@ -1379,14 +1379,14 @@ int gpst_esp_send_probes(struct openconnect_info *vpninfo)
                plen = sizeof(struct ip6_hdr) + icmplen;
        else
                plen = sizeof(struct ip) + icmplen;
-       struct pkt *pkt = malloc(sizeof(*pkt) + plen + vpninfo->pkt_trailer);
+       struct pkt *pkt = alloc_pkt(vpninfo, plen + vpninfo->pkt_trailer);
        if (!pkt)
                return -ENOMEM;
 
        if (vpninfo->dtls_fd == -1) {
                int fd = udp_connect(vpninfo);
                if (fd < 0) {
-                       free(pkt);
+                       free_pkt(vpninfo, pkt);
                        return fd;
                }
                /* We are not connected until we get an ESP packet back */
@@ -1496,7 +1496,7 @@ int gpst_esp_send_probes(struct openconnect_info *vpninfo)
                        vpn_progress(vpninfo, PRG_DEBUG, _("Failed to send ESP probe\n"));
        }
 
-       free(pkt);
+       free_pkt(vpninfo, pkt);
 
        vpninfo->dtls_times.last_tx = time(&vpninfo->new_dtls_started);
 
index 29d4abd665d966a1ff8ca5860f7680b6d031c051..8e43f3677dd58cb4919d0944a45f5e33295b203f 100644 (file)
--- a/library.c
+++ b/library.c
@@ -687,10 +687,10 @@ void openconnect_vpninfo_free(struct openconnect_info *vpninfo)
        inflateEnd(&vpninfo->inflate_strm);
        deflateEnd(&vpninfo->deflate_strm);
 
-       free(vpninfo->deflate_pkt);
-       free(vpninfo->tun_pkt);
-       free(vpninfo->dtls_pkt);
-       free(vpninfo->cstp_pkt);
+       free_pkt(vpninfo, vpninfo->deflate_pkt);
+       free_pkt(vpninfo, vpninfo->tun_pkt);
+       free_pkt(vpninfo, vpninfo->dtls_pkt);
+       free_pkt(vpninfo, vpninfo->cstp_pkt);
        free(vpninfo->bearer_token);
        free(vpninfo);
 }
index 6cafe7ebe810128e0773784f9091620728e5b4e8..834b5be268818d07441e662b1b2ed8919cb56025 100644 (file)
@@ -53,7 +53,7 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
        if (!tun_is_up(vpninfo)) {
                /* no tun yet; clear any queued packets */
                while ((this = dequeue_packet(&vpninfo->incoming_queue)))
-                       free(this);
+                       free_pkt(vpninfo, this);
 
                return 0;
        }
@@ -64,7 +64,7 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        int len = vpninfo->ip_info.mtu;
 
                        if (!out_pkt) {
-                               out_pkt = malloc(sizeof(struct pkt) + len + vpninfo->pkt_trailer);
+                               out_pkt = alloc_pkt(vpninfo, len + vpninfo->pkt_trailer);
                                if (!out_pkt) {
                                        vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                        break;
@@ -104,7 +104,7 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                vpninfo->stats.rx_pkts++;
                vpninfo->stats.rx_bytes += this->len;
 
-               free(this);
+               free_pkt(vpninfo, this);
        }
        /* Work is not done if we just got rid of packets off the queue */
        return work_done;
diff --git a/oncp.c b/oncp.c
index 1c90918dd3cb7b1a5d9ac2693cac59051ca2b2fe..58d7ad3df497534d4925b9956d00c7670cccb38f 100644 (file)
--- a/oncp.c
+++ b/oncp.c
@@ -730,7 +730,7 @@ int oncp_connect(struct openconnect_info *vpninfo)
        buf_free(reqbuf);
 
        vpninfo->partial_rec_size = 0;
-       free(vpninfo->cstp_pkt);
+       free_pkt(vpninfo, vpninfo->cstp_pkt);
        vpninfo->cstp_pkt = NULL;
 
        return ret;
@@ -858,7 +858,7 @@ int oncp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
 
                len = receive_mtu + vpninfo->pkt_trailer;
                if (!vpninfo->cstp_pkt) {
-                       vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + len);
+                       vpninfo->cstp_pkt = alloc_pkt(vpninfo, len);
                        if (!vpninfo->cstp_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -1080,7 +1080,7 @@ int oncp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                }
                /* Don't free the 'special' packets */
                if (vpninfo->current_ssl_pkt == vpninfo->deflate_pkt) {
-                       free(vpninfo->pending_deflated_pkt);
+                       free_pkt(vpninfo, vpninfo->pending_deflated_pkt);
                        vpninfo->pending_deflated_pkt = NULL;
                } else if (vpninfo->current_ssl_pkt == &esp_enable_pkt) {
                        /* Only set the ESP state to connected and actually start
@@ -1091,7 +1091,7 @@ int oncp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        vpninfo->dtls_state = DTLS_ESTABLISHED;
                        work_done = 1;
                } else {
-                       free(vpninfo->current_ssl_pkt);
+                       free_pkt(vpninfo, vpninfo->current_ssl_pkt);
                }
                vpninfo->current_ssl_pkt = NULL;
        }
@@ -1254,7 +1254,7 @@ int oncp_esp_send_probes(struct openconnect_info *vpninfo)
                monitor_except_fd(vpninfo, dtls);
        }
 
-       pkt = malloc(sizeof(*pkt) + 1 + vpninfo->pkt_trailer);
+       pkt = alloc_pkt(vpninfo, 1 + vpninfo->pkt_trailer);
        if (!pkt)
                return -ENOMEM;
 
@@ -1267,7 +1267,7 @@ int oncp_esp_send_probes(struct openconnect_info *vpninfo)
                    send(vpninfo->dtls_fd, (void *)&pkt->esp, pktlen, 0) < 0)
                        vpn_progress(vpninfo, PRG_DEBUG, _("Failed to send ESP probe\n"));
        }
-       free(pkt);
+       free_pkt(vpninfo, pkt);
 
        vpninfo->dtls_times.last_tx = time(&vpninfo->new_dtls_started);
 
index 06f4cec9c260f6885830ff9953badc060bdd55aa..63afa4b875b8dfacd39a76e9d0308de8f010e27e 100644 (file)
@@ -388,6 +388,17 @@ static inline void init_pkt_queue(struct pkt_q *q)
        q->tail = &q->head;
 }
 
+
+static inline struct pkt *alloc_pkt(struct openconnect_info *vpninfo, int len)
+{
+       return malloc(sizeof(struct pkt) + len);
+}
+
+static inline void free_pkt(struct openconnect_info *vpninfo, struct pkt *pkt)
+{
+       free(pkt);
+}
+
 #define TLS_OVERHEAD 5 /* packet + header */
 #define DTLS_OVERHEAD (1 /* packet + header */ + 13 /* DTLS header */ + \
         20 /* biggest supported MAC (SHA1) */ +  32 /* biggest supported IV (AES-256) */ + \
diff --git a/ppp.c b/ppp.c
index 05e88a281c40193d8f0364e85d905b12eabff804..59007c8d63ec9cea952d6d3460491e85e978d401 100644 (file)
--- a/ppp.c
+++ b/ppp.c
@@ -888,7 +888,7 @@ static int handle_state_transition(struct openconnect_info *vpninfo, int dtls,
 
                /* Drop any failed outgoing packet from previous connection;
                 * we need to reconfigure before we can send data packets. */
-               free(vpninfo->current_ssl_pkt);
+               free_pkt(vpninfo, vpninfo->current_ssl_pkt);
                vpninfo->current_ssl_pkt = NULL;
                vpninfo->partial_rec_size = 0;
                ppp->ppp_state = PPPS_ESTABLISH;
@@ -1089,7 +1089,7 @@ static int ppp_mainloop(struct openconnect_info *vpninfo, int dtls,
                int len, payload_len, next_len;
 
                if (!vpninfo->cstp_pkt) {
-                       vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                       vpninfo->cstp_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!vpninfo->cstp_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -1333,7 +1333,7 @@ static int ppp_mainloop(struct openconnect_info *vpninfo, int dtls,
                         * full sized packet so it can remain in vpninfo->cstp_pkt and be reused
                         * for receiving the next packet, if it's something other than data and
                         * doesn't get queued and freed. */
-                       this = vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                       this = vpninfo->cstp_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!this)
                                return -ENOMEM;
                        eh = this->data - rsv_hdr_size;
@@ -1384,7 +1384,7 @@ static int ppp_mainloop(struct openconnect_info *vpninfo, int dtls,
                        return 1;
                }
 
-               free(this);
+               free_pkt(vpninfo, this);
                vpninfo->current_ssl_pkt = NULL;
        }
 
@@ -1469,7 +1469,7 @@ static int ppp_mainloop(struct openconnect_info *vpninfo, int dtls,
                                                 proto == PPP_LCP ? ASYNCMAP_LCP : ppp->out_asyncmap);
                        if (!this)
                                return 1; /* XX */
-                       free(vpninfo->current_ssl_pkt);
+                       free_pkt(vpninfo, vpninfo->current_ssl_pkt);
                        vpninfo->current_ssl_pkt = this;
                }
 
@@ -1676,7 +1676,7 @@ int ppp_udp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readabl
                         * may be in active use while we attempt to connect DTLS.
                         * So use vpninfo->dtls_pkt for this. */
                        if (!vpninfo->dtls_pkt)
-                               vpninfo->dtls_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                               vpninfo->dtls_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!vpninfo->dtls_pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                dtls_close(vpninfo);
@@ -1707,7 +1707,7 @@ int ppp_udp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readabl
                        } else if (ret > 0) {
                                vpninfo->dtls_state = DTLS_ESTABLISHED;
                                vpninfo->dtls_pkt = NULL;
-                               free(this);
+                               free_pkt(vpninfo, this);
 
                                /* We are going to take over the PPP now; reset the TCP one */
                                ret = ppp_reset(vpninfo);
diff --git a/pulse.c b/pulse.c
index 280cc4a3f65cdc978daccfd976c19438809cf703..534bed13275df72c0aa64e6c29bce3fa9df187ee 100644 (file)
--- a/pulse.c
+++ b/pulse.c
@@ -2581,7 +2581,7 @@ int pulse_connect(struct openconnect_info *vpninfo)
        monitor_read_fd(vpninfo, ssl);
        monitor_except_fd(vpninfo, ssl);
 
-       free(vpninfo->cstp_pkt);
+       free_pkt(vpninfo, vpninfo->cstp_pkt);
        vpninfo->cstp_pkt = NULL;
 
        return ret;
@@ -2611,7 +2611,7 @@ int pulse_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                int len, payload_len;
 
                if (!pkt) {
-                       pkt = vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + receive_mtu);
+                       pkt = vpninfo->cstp_pkt = alloc_pkt(vpninfo, receive_mtu);
                        if (!pkt) {
                                vpn_progress(vpninfo, PRG_ERR, _("Allocation failed\n"));
                                break;
@@ -2798,10 +2798,10 @@ int pulse_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                }
                /* Don't free the 'special' packets */
                if (vpninfo->current_ssl_pkt == vpninfo->deflate_pkt) {
-                       free(vpninfo->pending_deflated_pkt);
+                       free_pkt(vpninfo, vpninfo->pending_deflated_pkt);
                        vpninfo->pending_deflated_pkt = NULL;
                } else
-                       free(vpninfo->current_ssl_pkt);
+                       free_pkt(vpninfo, vpninfo->current_ssl_pkt);
 
                vpninfo->current_ssl_pkt = NULL;
        }
diff --git a/ssl.c b/ssl.c
index a669738693caa3c82122aa8c6a5858083f8caef3..d5b33da4cb33fbb78fe25bc399c383abebee1339 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -1131,9 +1131,9 @@ int ssl_reconnect(struct openconnect_info *vpninfo)
        timeout = vpninfo->reconnect_timeout;
        interval = vpninfo->reconnect_interval;
 
-       free(vpninfo->dtls_pkt);
+       free_pkt(vpninfo, vpninfo->dtls_pkt);
        vpninfo->dtls_pkt = NULL;
-       free(vpninfo->tun_pkt);
+       free_pkt(vpninfo, vpninfo->tun_pkt);
        vpninfo->tun_pkt = NULL;
 
        while (1) {