Commit 899f57d
committed
Fix mem leak when duphandle fails in curl_clone_obj
Move init_curl_handle so that we don't leak memory if
curl_easy_duphandle fails within curl_clone_obj.
init_curl_handle allocates things, and curl_free_obj frees that again.
But curl_free_obj does nothing if ch->cp is not set. In curl_clone_obj,
do the allocation only once we have a valid cp, so that curl_free_obj
actually deallocates the memory again. If curl_easy_duphandle
fails we have not allocated anything and nothing is cleaned up.1 parent 68d605f commit 899f57d
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
444 | | - | |
445 | 444 | | |
446 | 445 | | |
447 | 446 | | |
| |||
450 | 449 | | |
451 | 450 | | |
452 | 451 | | |
| 452 | + | |
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| |||
0 commit comments