mirror of
https://github.com/curl/curl.git
synced 2026-07-25 19:27:17 +03:00
Bug #149: Deletion of unnecessary checks before calls of the function "free"
The function "free" is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software Coccinelle 1.0.0-rc24. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
This commit is contained in:
parent
059b3a5770
commit
29c655c0a6
40 changed files with 152 additions and 339 deletions
|
|
@ -121,13 +121,11 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
infof(data, "Establish HTTP proxy tunnel to %s:%hu\n",
|
||||
hostname, remote_port);
|
||||
|
||||
if(data->req.newurl) {
|
||||
/* This only happens if we've looped here due to authentication
|
||||
reasons, and we don't really use the newly cloned URL here
|
||||
then. Just free() it. */
|
||||
free(data->req.newurl);
|
||||
data->req.newurl = NULL;
|
||||
}
|
||||
free(data->req.newurl);
|
||||
data->req.newurl = NULL;
|
||||
|
||||
/* initialize a dynamic send-buffer */
|
||||
req_buffer = Curl_add_buffer_init();
|
||||
|
|
@ -552,11 +550,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
infof(data, "Connect me again please\n");
|
||||
}
|
||||
else {
|
||||
if(data->req.newurl) {
|
||||
/* this won't be used anymore for the CONNECT so free it now */
|
||||
free(data->req.newurl);
|
||||
data->req.newurl = NULL;
|
||||
}
|
||||
free(data->req.newurl);
|
||||
data->req.newurl = NULL;
|
||||
/* failure, close this connection to avoid re-use */
|
||||
connclose(conn, "proxy CONNECT failure");
|
||||
Curl_closesocket(conn, conn->sock[sockindex]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue