mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
make sure we free rangeline before we re-assign it to a new allocated
memory as otherwise we (might) leak memory
This commit is contained in:
parent
e399502c7a
commit
969217c9d9
@ -669,6 +669,9 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
if((data->set.httpreq == HTTPREQ_GET) &&
|
if((data->set.httpreq == HTTPREQ_GET) &&
|
||||||
!checkheaders(data, "Range:")) {
|
!checkheaders(data, "Range:")) {
|
||||||
|
/* if a line like this was already allocated, free the previous one */
|
||||||
|
if(conn->allocptr.rangeline)
|
||||||
|
free(conn->allocptr.rangeline);
|
||||||
conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n", conn->range);
|
conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n", conn->range);
|
||||||
}
|
}
|
||||||
else if((data->set.httpreq != HTTPREQ_GET) &&
|
else if((data->set.httpreq != HTTPREQ_GET) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user