Commit d20129b
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 f6fe838 commit d20129b
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | | - | |
404 | 403 | | |
405 | 404 | | |
406 | 405 | | |
| |||
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| |||
0 commit comments