[PATCH 20/24] Fix a couple of valgrind warnings

Kevin Cernekee cernekee at gmail.com
Sat Nov 3 13:23:02 EDT 2012


Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 auth.c    |    4 ----
 http.c    |   12 ++++++++----
 library.c |    7 +++++++
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/auth.c b/auth.c
index de02e77..1092dbb 100644
--- 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
--- 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;
 }
 
diff --git a/library.c b/library.c
index 16b7bab..73e7c54 100644
--- 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. */
-- 
1.7.10.4




More information about the openconnect-devel mailing list