static void tunnel_free(struct Curl_cfilter *cf,
struct Curl_easy *data)
{
- struct h1_tunnel_state *ts = cf->ctx;
- if(ts) {
- h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data);
- Curl_dyn_free(&ts->rcvbuf);
- Curl_dyn_free(&ts->request_data);
- Curl_httpchunk_free(data, &ts->ch);
- free(ts);
- cf->ctx = NULL;
+ if(cf) {
+ struct h1_tunnel_state *ts = cf->ctx;
+ if(ts) {
+ h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data);
+ Curl_dyn_free(&ts->rcvbuf);
+ Curl_dyn_free(&ts->request_data);
+ Curl_httpchunk_free(data, &ts->ch);
+ free(ts);
+ cf->ctx = NULL;
+ }
}
}
struct Curl_easy *data)
{
CURL_TRC_CF(data, cf, "close");
- cf->connected = FALSE;
- if(cf->ctx) {
- h1_tunnel_go_state(cf, cf->ctx, H1_TUNNEL_INIT, data);
+ if(cf) {
+ cf->connected = FALSE;
+ if(cf->ctx) {
+ h1_tunnel_go_state(cf, cf->ctx, H1_TUNNEL_INIT, data);
+ }
+ if(cf->next)
+ cf->next->cft->do_close(cf->next, data);
}
- if(cf->next)
- cf->next->cft->do_close(cf->next, data);
}