>
> void Bearer::Authenticate(CURL* pCurl) const
>
> {
>
> CURLcode c = CURLE_OK;
>
>
>
> std::cerr << "Warning: memory set with CURLOPT_XOAUTH2_BEARER is known
> to leak." << std::endl;
>
>
>
> // This libcurl code works, but leaks the bearer token.
>
> // https://github.com/curl/curl/issues/8841
>
> c = curl_easy_setopt(pCurl, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);
>
> if (CURLE_OK != c)
>
> throw std::system_error(c, curl_category());
>
> c = curl_easy_setopt(pCurl, CURLOPT_XOAUTH2_BEARER, getToken());
>
> if (CURLE_OK != c)
>
> throw std::system_error(c, curl_category());
>
> }
>
Thanks all for your kind replies and thanks for this Matthew. The memory
leak comment above is a bit worrying? Is that a known bug upstream?
I ended up doing this:
https://github.com/SentryPeer/SentryPeer/blob/main/src/json_logger.c#L175
after requesting my token:
https://github.com/SentryPeer/SentryPeer/blob/main/src/json_logger.c#L67
Hopefully get change to refactor it and delete some code :-)
--
Kind Regards,
Gavin Henry.
https://sentrypeer.org
--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html