[PATCH 6/6] auth-juniper: Check asprintf() return values
Kevin Cernekee
cernekee at gmail.com
Sun Feb 8 14:20:41 PST 2015
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
More information about the openconnect-devel
mailing list