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:
Markus Elfring 2015-03-11 17:41:01 +01:00 committed by Daniel Stenberg
parent 059b3a5770
commit 29c655c0a6
40 changed files with 152 additions and 339 deletions

View file

@ -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();

View file

@ -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);

View file

@ -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();

View file

@ -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();

View file

@ -195,9 +195,7 @@ int test(char *URL)
}
test_cleanup:
if(stream_uri)
free(stream_uri);
free(stream_uri);
if(protofile)
fclose(protofile);

View file

@ -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);

View file

@ -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;
}