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:
22
lib/imap.c
22
lib/imap.c
@@ -547,8 +547,8 @@ static CURLcode imap_perform_login(struct connectdata *conn)
|
||||
result = imap_sendf(conn, "LOGIN %s %s", user ? user : "",
|
||||
passwd ? passwd : "");
|
||||
|
||||
Curl_safefree(user);
|
||||
Curl_safefree(passwd);
|
||||
free(user);
|
||||
free(passwd);
|
||||
|
||||
if(!result)
|
||||
state(conn, IMAP_LOGIN);
|
||||
@@ -661,7 +661,7 @@ static CURLcode imap_perform_list(struct connectdata *conn)
|
||||
/* Send the LIST command */
|
||||
result = imap_sendf(conn, "LIST \"%s\" *", mailbox);
|
||||
|
||||
Curl_safefree(mailbox);
|
||||
free(mailbox);
|
||||
}
|
||||
|
||||
if(!result)
|
||||
@@ -702,7 +702,7 @@ static CURLcode imap_perform_select(struct connectdata *conn)
|
||||
/* Send the SELECT command */
|
||||
result = imap_sendf(conn, "SELECT %s", mailbox);
|
||||
|
||||
Curl_safefree(mailbox);
|
||||
free(mailbox);
|
||||
|
||||
if(!result)
|
||||
state(conn, IMAP_SELECT);
|
||||
@@ -777,7 +777,7 @@ static CURLcode imap_perform_append(struct connectdata *conn)
|
||||
result = imap_sendf(conn, "APPEND %s (\\Seen) {%" CURL_FORMAT_CURL_OFF_T "}",
|
||||
mailbox, conn->data->state.infilesize);
|
||||
|
||||
Curl_safefree(mailbox);
|
||||
free(mailbox);
|
||||
|
||||
if(!result)
|
||||
state(conn, IMAP_APPEND);
|
||||
@@ -1800,7 +1800,7 @@ static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...)
|
||||
result = Curl_pp_vsendf(&imapc->pp, taggedfmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
Curl_safefree(taggedfmt);
|
||||
free(taggedfmt);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -2031,7 +2031,7 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
||||
/* Decode the value parameter */
|
||||
result = Curl_urldecode(data, begin, ptr - begin, &value, &valuelen, TRUE);
|
||||
if(result) {
|
||||
Curl_safefree(name);
|
||||
free(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2070,14 +2070,14 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
||||
value = NULL;
|
||||
}
|
||||
else {
|
||||
Curl_safefree(name);
|
||||
Curl_safefree(value);
|
||||
free(name);
|
||||
free(value);
|
||||
|
||||
return CURLE_URL_MALFORMAT;
|
||||
}
|
||||
|
||||
Curl_safefree(name);
|
||||
Curl_safefree(value);
|
||||
free(name);
|
||||
free(value);
|
||||
}
|
||||
|
||||
/* Does the URL contain a query parameter? Only valid when we have a mailbox
|
||||
|
||||
Reference in New Issue
Block a user