tidy-up: replace Curl_safefree with free before re-assignment

Also drop `NULL` assignments after `Curl_safefree()`.

Closes #16640
This commit is contained in:
Viktor Szakats 2025-03-10 00:31:20 +01:00
parent 9b523773b8
commit 57218d5327
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
15 changed files with 45 additions and 49 deletions

View file

@ -1262,7 +1262,7 @@ sftp_pkey_init(struct Curl_easy *data,
if(!sshc->rsa)
out_of_memory = TRUE;
else if(stat(sshc->rsa, &sbuf)) {
Curl_safefree(sshc->rsa);
free(sshc->rsa);
sshc->rsa = aprintf("%s/.ssh/id_dsa", home);
if(!sshc->rsa)
out_of_memory = TRUE;
@ -1276,10 +1276,10 @@ sftp_pkey_init(struct Curl_easy *data,
/* Nothing found; try the current dir. */
sshc->rsa = strdup("id_rsa");
if(sshc->rsa && stat(sshc->rsa, &sbuf)) {
Curl_safefree(sshc->rsa);
free(sshc->rsa);
sshc->rsa = strdup("id_dsa");
if(sshc->rsa && stat(sshc->rsa, &sbuf)) {
Curl_safefree(sshc->rsa);
free(sshc->rsa);
/* Out of guesses. Set to the empty string to avoid
* surprising info messages. */
sshc->rsa = strdup("");