setopt: defref the old referer when setting a new

Closes #21826
This commit is contained in:
Daniel Stenberg 2026-06-01 13:31:11 +02:00
parent 6ff5c8ac4a
commit ff300ac4aa
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2024,6 +2024,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
/*
* String to set in the HTTP Referer: field.
*/
Curl_bufref_free(&data->state.referer);
result = Curl_setstropt(&s->str[STRING_SET_REFERER], ptr);
break;