]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
gpst: Fix memory leak if udp_connect() fails.
authorraminfp <ramin.blackhat@gmail.com>
Wed, 29 May 2019 15:21:02 +0000 (15:21 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Sun, 9 Jun 2019 23:55:40 +0000 (00:55 +0100)
Signed-off-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
gpst.c

diff --git a/gpst.c b/gpst.c
index 0148e7688a2e83b3dee5c0742c5fd0921d30a645..088cb40d2152f855f71b283fe406998aae337f61 100644 (file)
--- a/gpst.c
+++ b/gpst.c
@@ -1309,9 +1309,10 @@ int gpst_esp_send_probes(struct openconnect_info *vpninfo)
 
        if (vpninfo->dtls_fd == -1) {
                int fd = udp_connect(vpninfo);
-               if (fd < 0)
+               if (fd < 0) {
+                       free(pkt);
                        return fd;
-
+               }
                /* We are not connected until we get an ESP packet back */
                vpninfo->dtls_state = DTLS_SLEEPING;
                vpninfo->dtls_fd = fd;