mirror of
https://github.com/curl/curl.git
synced 2026-06-14 21:45:44 +03:00
curl_share.c try to defeat clang-tidy
```
/home/runner/work/curl/curl/lib/curl_setup.h:1650:7: error: check of ‘share’ for NULL after already dereferencing it [-Werror=analyzer-deref-before-check]
1650 | if(ptr) \
| ^
/home/runner/work/curl/curl/lib/curl_share.c:64:3: note: in expansion of macro ‘curlx_memzero’
64 | curlx_memzero(share, sizeof(*share));
| ^~~~~~~~~~~~~
‘share_destroy’: events 1-3
|
| 37 | if(share->specifier & (1 << CURL_LOCK_DATA_CONNECT)) {
| | ~~~~~^~~~~~~~~~~
| | |
| | (1) pointer ‘share’ is dereferenced here
|......
| 52 | if(share->ssl_scache) {
| | ~
| | |
| | (2) following ‘false’ branch...
|......
| 58 | Curl_psl_destroy(&share->psl);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (3) ...to here
|
‘share_destroy’: event 4
|
|/home/runner/work/curl/curl/lib/curl_setup.h:1650:7:
| 1650 | if(ptr) \
| | ^
| | |
| | (4) pointer ‘share’ is checked for NULL here but it was already dereferenced at (1)
/home/runner/work/curl/curl/lib/curl_share.c:64:3: note: in expansion of macro ‘curlx_memzero’
| 64 | curlx_memzero(share, sizeof(*share));
| | ^~~~~~~~~~~~~
|
```
https://github.com/curl/curl/actions/runs/25960248795/job/76314218955?pr=21637
This commit is contained in:
parent
080c38b3ef
commit
5ba93cf433
1 changed files with 3 additions and 0 deletions
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
static void share_destroy(struct Curl_share *share)
|
||||
{
|
||||
if(!share)
|
||||
return;
|
||||
|
||||
if(share->specifier & (1 << CURL_LOCK_DATA_CONNECT)) {
|
||||
Curl_cpool_destroy(&share->cpool);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue