free: instead of Curl_safefree()

Since we just started make use of free(NULL) in order to simplify code,
this change takes it a step further and:

- converts lots of Curl_safefree() calls to good old free()
- makes Curl_safefree() not check the pointer before free()

The (new) rule of thumb is: if you really want a function call that
frees a pointer and then assigns it to NULL, then use Curl_safefree().
But we will prefer just using free() from now on.
This commit is contained in:
Daniel Stenberg
2015-03-16 15:01:15 +01:00
parent 9e661601fe
commit 0f4a03cbb6
35 changed files with 202 additions and 202 deletions

View File

@@ -571,7 +571,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
auth = strdup("<>");
if(!auth) {
Curl_safefree(from);
free(from);
return CURLE_OUT_OF_MEMORY;
}
@@ -582,8 +582,8 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
size = aprintf("%" CURL_FORMAT_CURL_OFF_T, data->state.infilesize);
if(!size) {
Curl_safefree(from);
Curl_safefree(auth);
free(from);
free(auth);
return CURLE_OUT_OF_MEMORY;
}
@@ -603,9 +603,9 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
result = Curl_pp_sendf(&conn->proto.smtpc.pp,
"MAIL FROM:%s SIZE=%s", from, size);
Curl_safefree(from);
Curl_safefree(auth);
Curl_safefree(size);
free(from);
free(auth);
free(size);
if(!result)
state(conn, SMTP_MAIL);
@@ -1657,13 +1657,13 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
data->state.scratch = scratch;
/* Free the old scratch buffer */
Curl_safefree(oldscratch);
free(oldscratch);
/* Set the new amount too */
data->req.upload_present = si;
}
else
Curl_safefree(newscratch);
free(newscratch);
return CURLE_OK;
}