cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-845168 ] Bug in code of transfer.c -- with fix

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Wed, 19 Nov 2003 06:52:45 -0800

Bugs item #845168, was opened at 2003-11-19 06:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=845168&group_id=976

Category: libcurl
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: Bug in code of transfer.c -- with fix

Initial Comment:
libcurl 7.10.8, transfer.c, from line 1852:
      /* If a callback (or something) has altered the URL
we should use within
         the Curl_connect(), we detect it here and act as if
we are redirected
         to the new URL */
      urlchanged = data->change.url_changed;
      if ((CURLE_OK == res) && urlchanged) {
        char *gotourl;
        res = Curl_done(conn);
        if(CURLE_OK == res) {
          newurl = strdup(data->change.url);
          res = Curl_follow(data, gotourl);
          if(res)
            free(gotourl);
        }
      }

WatcomC++ said:
.\transfer.c(1857): Warning! W200: 'gotourl' has been
referenced but never assigned a value

And this because you call Curl_follow(data, gotourl) while
need to call Curl_follow(data, newurl), also need to
remove "char * gotourl" and change free to "free(newurl)
".

So, diff is:
--- TRANSFER.C Sat Oct 25 04:54:34 2003
+++ fix/transfer.c Wed Nov 19 20:50:50 2003
@@ -1854,13 +1854,12 @@
          to the new URL */
       urlchanged = data->change.url_changed;
       if ((CURLE_OK == res) && urlchanged) {
- char *gotourl;
         res = Curl_done(conn);
         if(CURLE_OK == res) {
           newurl = strdup(data->change.url);
- res = Curl_follow(data, gotourl);
+ res = Curl_follow(data, newurl);
           if(res)
- free(gotourl);
+ free(newurl);
         }
       }
     } while (urlchanged && res == CURLE_OK) ;

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=845168&group_id=976

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-19