Free CSTP option structure before error return if malloc fails
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 26 Sep 2012 19:21:37 +0000 (20:21 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 26 Sep 2012 19:21:37 +0000 (20:21 +0100)
Spotted by Coverity.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
cstp.c

diff --git a/cstp.c b/cstp.c
index 284dcdf..dacb2ae 100644 (file)
--- a/cstp.c
+++ b/cstp.c
@@ -302,6 +302,9 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
 
                if (!new_option->option || !new_option->value) {
                        vpn_progress(vpninfo, PRG_ERR, _("No memory for options\n"));
+                       free(new_option->option);
+                       free(new_option->value);
+                       free(new_option);
                        return -ENOMEM;
                }