Fix a couple of valgrind warnings
authorKevin Cernekee <cernekee@gmail.com>
Sun, 28 Oct 2012 07:01:27 +0000 (00:01 -0700)
committerKevin Cernekee <cernekee@gmail.com>
Sun, 28 Oct 2012 08:22:56 +0000 (01:22 -0700)
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
auth.c
http.c
library.c

diff --git a/auth.c b/auth.c
index de02e77..1092dbb 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -437,7 +437,6 @@ static int parse_auth_node(struct openconnect_info *vpninfo, xmlNode *xml_node,
                                ret = -EINVAL;
                                goto out;
                        }
-                       vpninfo->redirect_url = strdup(form->action);
 
                        ret = parse_form(vpninfo, form, xml_node);
                        if (ret < 0)
@@ -577,9 +576,6 @@ int handle_auth_form(struct openconnect_info *vpninfo, struct oc_auth_form *form
        }
 
        if (vpninfo->csd_token && vpninfo->csd_ticket && vpninfo->csd_starturl && vpninfo->csd_waiturl) {
-               /* First, redirect to the stuburl -- we'll need to fetch and run that */
-               vpninfo->redirect_url = strdup(vpninfo->csd_stuburl);
-
                /* AB: remove all cookies */
                for (opt = vpninfo->cookies; opt; opt = next) {
                        next = opt->next;
diff --git a/http.c b/http.c
index fdac639..c05340f 100644 (file)
--- a/http.c
+++ b/http.c
@@ -618,8 +618,10 @@ out:
 
        free(vpninfo->csd_stuburl);
        vpninfo->csd_stuburl = NULL;
+       free(vpninfo->urlpath);
        vpninfo->urlpath = strdup(vpninfo->csd_waiturl +
                                  (vpninfo->csd_waiturl[0] == '/' ? 1 : 0));
+       free(vpninfo->csd_waiturl);
        vpninfo->csd_waiturl = NULL;
        vpninfo->csd_scriptname = strdup(fname);
 
@@ -1098,16 +1100,18 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
                                fetch_config(vpninfo, bu, fu, sha);
                }
        }
+       result = 0;
+
+out:
+       free(form_buf);
+       free_auth_form(form);
+
        if (vpninfo->csd_scriptname) {
                unlink(vpninfo->csd_scriptname);
                free(vpninfo->csd_scriptname);
                vpninfo->csd_scriptname = NULL;
        }
-       result = 0;
 
-out:
-       free(form_buf);
-       free_auth_form(form);
        return result;
 }
 
index 16b7bab..73e7c54 100644 (file)
--- a/library.c
+++ b/library.c
@@ -109,13 +109,20 @@ void openconnect_vpninfo_free (struct openconnect_info *vpninfo)
        free(vpninfo->redirect_url);
        free(vpninfo->proxy_type);
        free(vpninfo->proxy);
+
        if (vpninfo->csd_scriptname) {
                unlink(vpninfo->csd_scriptname);
                free(vpninfo->csd_scriptname);
        }
+       free(vpninfo->csd_token);
+       free(vpninfo->csd_ticket);
        free(vpninfo->csd_stuburl);
+       free(vpninfo->csd_starturl);
+       free(vpninfo->csd_waiturl);
+       free(vpninfo->csd_preurl);
        if (vpninfo->opaque_srvdata)
                xmlFreeNode(vpninfo->opaque_srvdata);
+
        /* These are const in openconnect itself, but for consistency of
           the library API we do take ownership of the strings we're given,
           and thus we have to free them too. */