[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openconnect-devel
Subject:    [PATCH 6/6] auth-juniper: Check asprintf() return values
From:       cernekee () gmail ! com (Kevin Cernekee)
Date:       2015-02-08 22:20:41
Message-ID: 1423434041-6197-6-git-send-email-cernekee () gmail ! com
[Download RAW message or body]

This fixes a compile warning:

    auth-juniper.c: In function 'parse_input_node':
    auth-juniper.c:108:11: warning: ignoring return value of 'asprintf', declared \
with attribute warn_unused_result [-Wunused-result]  auth-juniper.c:114:11: warning: \
ignoring return value of 'asprintf', declared with attribute warn_unused_result \
[-Wunused-result]

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 auth-juniper.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/auth-juniper.c b/auth-juniper.c
index b9b732b6ace7..de89f222b7f9 100644
--- a/auth-juniper.c
+++ b/auth-juniper.c
@@ -105,13 +105,19 @@ static int parse_input_node(struct openconnect_info *vpninfo, \
struct oc_auth_for  } else if (!strcasecmp(type, "password")) {
 		opt->type = OC_FORM_OPT_PASSWORD;
 		xmlnode_get_prop(node, "name", &opt->name);
-		asprintf(&opt->label, "%s:", opt->name);
+		if (asprintf(&opt->label, "%s:", opt->name) == -1) {
+			free_opt(opt);
+			return -ENOMEM;
+		}
 		if (!oncp_can_gen_tokencode(vpninfo, form, opt))
 			opt->type = OC_FORM_OPT_TOKEN;
 	} else if (!strcasecmp(type, "text")) {
 		opt->type = OC_FORM_OPT_TEXT;
 		xmlnode_get_prop(node, "name", &opt->name);
-		asprintf(&opt->label, "%s:", opt->name);
+		if (asprintf(&opt->label, "%s:", opt->name) == -1) {
+			free_opt(opt);
+			return -ENOMEM;
+		}
 	} else if (!strcasecmp(type, "submit")) {
 		xmlnode_get_prop(node, "name", &opt->name);
 		if (!opt->name || strcmp(opt->name, submit_button)) {
-- 
2.2.2


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic