curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: CURLOPT_XOAUTH2_BEARER use?

From: Gavin Henry via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 21 Feb 2023 09:55:08 +0000

>
> 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
Received on 2023-02-21