]> granicus.if.org Git - curl/commitdiff
HTTP resume fix, now the range pointer may be allocated
authorDaniel Stenberg <daniel@haxx.se>
Fri, 6 Oct 2000 06:28:39 +0000 (06:28 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 6 Oct 2000 06:28:39 +0000 (06:28 +0000)
lib/url.c
lib/urldata.h

index 582d03da007f24e06330b65aff743b423b23cefe..3865d201e0e16363f4678048fb543fbd3e148efa 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -183,6 +183,11 @@ void static urlfree(struct UrlData *data, bool totally)
        switch off that knowledge again... */
     data->bits.httpproxy=FALSE;
   }
+  
+  if(data->bits.rangestringalloc) {
+    free(data->range);
+    data->range=NULL;
+  }
 
   if(data->ptr_proxyuserpwd) {
     free(data->ptr_proxyuserpwd);
@@ -906,7 +911,8 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
     if(!data->bits.set_range) {
       /* if it already was in use, we just skip this */
       sprintf(resumerange, "%d-", data->resume_from);
-      data->range=resumerange; /* tell ourselves to fetch this range */
+      data->range=strdup(resumerange); /* tell ourselves to fetch this range */
+      data->bits.rangestringalloc = TRUE; /* mark as allocated */
       data->bits.set_range = 1; /* switch on range usage */
     }
   }
index 241bfc2687711420d1273c74e8390f23167fd5f0..87e49a84052d598ea7b9f924656eb443cae98a91 100644 (file)
@@ -307,6 +307,7 @@ struct Configbits {
   bool proxystringalloc; /* the http proxy string is malloc()'ed */
   bool set_port;
   bool set_range;
+  bool rangestringalloc; /* the range string is malloc()'ed */
   bool upload;
   bool use_netrc;
   bool user_passwd;