From: Daniel Stenberg Date: Sun, 4 Jan 2026 10:54:18 +0000 (+0100) Subject: setopt: free the previous STRING_ENCODING before storing the new X-Git-Tag: curl-8_18_0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c8f9c92473fde2a6918b1b005f39f536c26feb4;p=thirdparty%2Fcurl.git setopt: free the previous STRING_ENCODING before storing the new Follow-up to 6b9c75e219cdcfd3e17e7858 Fixes #20179 Reported-by: correctmost on github Closes #20180 --- diff --git a/lib/setopt.c b/lib/setopt.c index 06e7dd1b86..0c1da5bc12 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -1725,8 +1725,10 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option, */ if(ptr && !*ptr) { ptr = Curl_get_content_encodings(); - if(ptr) + if(ptr) { + curlx_free(s->str[STRING_ENCODING]); s->str[STRING_ENCODING] = ptr; + } else result = CURLE_OUT_OF_MEMORY; return result;