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

List:       openconnect-devel
Subject:    [PATCH] http: Check asprintf() return value
From:       cernekee () gmail ! com (Kevin Cernekee)
Date:       2014-06-18 15:40:57
Message-ID: 1403106057-25314-1-git-send-email-cernekee () gmail ! com
[Download RAW message or body]

This fixes the following warning:

      CC       libopenconnect_la-http.lo
    http.c: In function 'openconnect_obtain_cookie':
    http.c:1270:13: warning: ignoring return value of 'asprintf', declared with \
attribute warn_unused_result [-Wunused-result]  asprintf(&vpninfo->profile_url, \
"%s%s", bu, fu);  ^

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 http.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/http.c b/http.c
index 90ac060..6fec357 100644
--- a/http.c
+++ b/http.c
@@ -1267,7 +1267,10 @@ newgroup:
 			} while ((tok = strchr(tok, '&')));
 
 			if (bu && fu && sha) {
-				asprintf(&vpninfo->profile_url, "%s%s", bu, fu);
+				if (asprintf(&vpninfo->profile_url, "%s%s", bu, fu) == -1) {
+					result = -ENOMEM;
+					goto out;
+				}
 				vpninfo->profile_sha1 = strdup(sha);
 			}
 		}
-- 
1.7.9.5


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

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