diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-10-24 00:16:59 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-10-24 00:16:59 +0100 |
commit | 650036633ffdc95c8c2181ce85582bbf3939582e (patch) | |
tree | 298646a1f125e3a7cae64e43e009a2d19c94eb7c | |
parent | 78aee26be61a3375dba40583c1233f39e941c803 (diff) |
sasl: Fixed memory leak in OAUTH2 message creation
-rw-r--r-- | lib/curl_sasl.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index d399d6a7e..52ae2827c 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -514,6 +514,7 @@ CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data, const char *bearer, char **outptr, size_t *outlen) { + CURLcode result = CURLE_OK; char *xoauth; xoauth = aprintf("user=%s\1auth=Bearer %s\1\1", user, bearer); @@ -522,8 +523,12 @@ CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data, return CURLE_OUT_OF_MEMORY; /* Base64 encode the reply */ - return Curl_base64_encode(data, xoauth, strlen(xoauth), outptr, - outlen); + result = Curl_base64_encode(data, xoauth, strlen(xoauth), outptr, + outlen); + + Curl_safefree(xoauth); + + return result; } /* |