mirror of
https://github.com/curl/curl.git
synced 2026-08-26 18:23:32 +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
|
|
@ -83,8 +83,7 @@ int test(char *URL)
|
|||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(slist);
|
||||
if(newURL)
|
||||
free(newURL);
|
||||
free(newURL);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
|
|
|
|||
|
|
@ -159,8 +159,7 @@ test_cleanup:
|
|||
if(sdpf)
|
||||
fclose(sdpf);
|
||||
|
||||
if(stream_uri)
|
||||
free(stream_uri);
|
||||
free(stream_uri);
|
||||
|
||||
if(custom_headers)
|
||||
curl_slist_free_all(custom_headers);
|
||||
|
|
|
|||
|
|
@ -115,9 +115,7 @@ test_cleanup:
|
|||
if(idfile)
|
||||
fclose(idfile);
|
||||
|
||||
if(stream_uri)
|
||||
free(stream_uri);
|
||||
|
||||
free(stream_uri);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
|
|
|
|||
|
|
@ -102,9 +102,7 @@ int test(char *URL)
|
|||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
if(stream_uri)
|
||||
free(stream_uri);
|
||||
free(stream_uri);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
|
|
|||
|
|
@ -195,9 +195,7 @@ int test(char *URL)
|
|||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
if(stream_uri)
|
||||
free(stream_uri);
|
||||
free(stream_uri);
|
||||
|
||||
if(protofile)
|
||||
fclose(protofile);
|
||||
|
|
|
|||
|
|
@ -165,8 +165,7 @@ test_cleanup:
|
|||
if(paramsf)
|
||||
fclose(paramsf);
|
||||
|
||||
if(stream_uri)
|
||||
free(stream_uri);
|
||||
free(stream_uri);
|
||||
|
||||
if(custom_headers)
|
||||
curl_slist_free_all(custom_headers);
|
||||
|
|
|
|||
|
|
@ -357,10 +357,8 @@ test_cleanup:
|
|||
fclose(hd_src);
|
||||
|
||||
/* free local memory */
|
||||
if(sockets.read.sockets)
|
||||
free(sockets.read.sockets);
|
||||
if(sockets.write.sockets)
|
||||
free(sockets.write.sockets);
|
||||
free(sockets.read.sockets);
|
||||
free(sockets.write.sockets);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue