Modify Rule S4423[cfamily]: add nullptr check for libcurl examples
Co-authored-by: Arseniy Zaostrovnykh <necto.ne@gmail.com>
This commit is contained in:
parent
bd355a1e03
commit
d1e98e9eb9
@ -18,9 +18,11 @@ void encrypt() {
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init(); // Noncompliant
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
if (curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
|
||||
curl_easy_perform(curl);
|
||||
curl_easy_perform(curl);
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
@ -35,10 +37,12 @@ void encrypt() {
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
|
||||
if (curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
|
||||
|
||||
curl_easy_perform(curl);
|
||||
curl_easy_perform(curl);
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user