Commit 9e661601 authored by Markus Elfring's avatar Markus Elfring Committed by Daniel Stenberg
Browse files

Bug #149: Deletion of unnecessary checks before a few calls of cURL functions



The following functions return immediately if a null pointer was passed.
* Curl_cookie_cleanup
* curl_formfree

It is therefore not needed that a function caller repeats a corresponding check.

This issue was fixed by using the software Coccinelle 1.0.0-rc24.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
parent 29c655c0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -969,7 +969,6 @@ void curl_formfree(struct curl_httppost *form)
    next=form->next;  /* the following form line */

    /* recurse to sub-contents */
    if(form->more)
    curl_formfree(form->more);

    if(!(form->flags & HTTPPOST_PTRNAME))
+1 −2
Original line number Diff line number Diff line
@@ -198,7 +198,6 @@ curl_share_cleanup(CURLSH *sh)
  }

#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
  if(share->cookies)
  Curl_cookie_cleanup(share->cookies);
#endif

+1 −2
Original line number Diff line number Diff line
@@ -2150,7 +2150,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
      if(data->share->cookies) {
        /* use shared cookie list, first free own one if any */
        if(data->cookies)
        Curl_cookie_cleanup(data->cookies);
        /* enable cookies since we now use a share that uses cookies! */
        data->cookies = data->share->cookies;