mirror of
https://github.com/curl/curl.git
synced 2026-08-25 21:03:34 +03:00
content_encoding: make Curl_all_content_encodings allocless
- Fixes a memory leak pointed out by Coverity
- Also found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63947
- Avoids unncessary allocations
Follow-up ad051e1cbe
Closes #12289
This commit is contained in:
parent
36662c3860
commit
82ba603da4
3 changed files with 27 additions and 26 deletions
10
lib/setopt.c
10
lib/setopt.c
|
|
@ -592,13 +592,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
*/
|
||||
argptr = va_arg(param, char *);
|
||||
if(argptr && !*argptr) {
|
||||
argptr = Curl_all_content_encodings();
|
||||
if(!argptr)
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
else {
|
||||
result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
|
||||
free(argptr);
|
||||
}
|
||||
char all[256];
|
||||
Curl_all_content_encodings(all, sizeof(all));
|
||||
result = Curl_setstropt(&data->set.str[STRING_ENCODING], all);
|
||||
}
|
||||
else
|
||||
result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue