easy_cleanup: require a "good" handle to act
By insisting that the passed in handle is "good" (the magic number is intact), this can limit the potential damage if a bad pointer is passed in. Like when this function is called twice on the same handle pointer. Ref: #10964 Closes #11061
This commit is contained in:
parent
b8d7746e3c
commit
d8df0d6db7
14
lib/easy.c
14
lib/easy.c
@ -787,14 +787,12 @@ CURLcode curl_easy_perform_ev(struct Curl_easy *data)
|
||||
*/
|
||||
void curl_easy_cleanup(struct Curl_easy *data)
|
||||
{
|
||||
SIGPIPE_VARIABLE(pipe_st);
|
||||
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
sigpipe_ignore(data, &pipe_st);
|
||||
Curl_close(&data);
|
||||
sigpipe_restore(&pipe_st);
|
||||
if(GOOD_EASY_HANDLE(data)) {
|
||||
SIGPIPE_VARIABLE(pipe_st);
|
||||
sigpipe_ignore(data, &pipe_st);
|
||||
Curl_close(&data);
|
||||
sigpipe_restore(&pipe_st);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user