mirror of
https://github.com/curl/curl.git
synced 2026-07-28 04:23:07 +03:00
meta data handling for easy/conn fixes
- return error when adding to hash fails - do not free passed in data, as ownership is taken by call Closes #17219
This commit is contained in:
parent
9f57c2ea95
commit
f0824d1ed7
4 changed files with 8 additions and 10 deletions
|
|
@ -431,11 +431,10 @@ static CURLcode doh_probe_run(struct Curl_easy *data,
|
|||
doh->state.internal = TRUE;
|
||||
doh->master_mid = data->mid; /* master transfer of this one */
|
||||
|
||||
if(Curl_meta_set(doh, CURL_EZM_DOH_PROBE, doh_req, doh_probe_dtor)) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
result = Curl_meta_set(doh, CURL_EZM_DOH_PROBE, doh_req, doh_probe_dtor);
|
||||
doh_req = NULL; /* call took ownership */
|
||||
if(result)
|
||||
goto error;
|
||||
}
|
||||
doh_req = NULL;
|
||||
|
||||
/* DoH handles must not inherit private_data. The handles may be passed to
|
||||
the user via callbacks and the user will be able to identify them as
|
||||
|
|
|
|||
|
|
@ -1393,6 +1393,7 @@ CURLcode Curl_meta_set(struct Curl_easy *data, const char *key,
|
|||
if(!Curl_hash_add2(&data->meta_hash, CURL_UNCONST(key), strlen(key) + 1,
|
||||
meta_data, meta_dtor)) {
|
||||
meta_dtor(CURL_UNCONST(key), strlen(key) + 1, meta_data);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -453,10 +453,8 @@ mev_add_new_conn_pollset(struct connectdata *conn)
|
|||
ps = calloc(1, sizeof(*ps));
|
||||
if(!ps)
|
||||
return NULL;
|
||||
if(Curl_conn_meta_set(conn, CURL_META_MEV_POLLSET, ps, mev_pollset_dtor)) {
|
||||
free(ps);
|
||||
if(Curl_conn_meta_set(conn, CURL_META_MEV_POLLSET, ps, mev_pollset_dtor))
|
||||
return NULL;
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
||||
|
|
@ -468,10 +466,8 @@ mev_add_new_xfer_pollset(struct Curl_easy *data)
|
|||
ps = calloc(1, sizeof(*ps));
|
||||
if(!ps)
|
||||
return NULL;
|
||||
if(Curl_meta_set(data, CURL_META_MEV_POLLSET, ps, mev_pollset_dtor)) {
|
||||
free(ps);
|
||||
if(Curl_meta_set(data, CURL_META_MEV_POLLSET, ps, mev_pollset_dtor))
|
||||
return NULL;
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3965,9 +3965,11 @@ CURLcode Curl_conn_meta_set(struct connectdata *conn, const char *key,
|
|||
if(!Curl_hash_add2(&conn->meta_hash, CURL_UNCONST(key), strlen(key) + 1,
|
||||
meta_data, meta_dtor)) {
|
||||
meta_dtor(CURL_UNCONST(key), strlen(key) + 1, meta_data);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
void Curl_conn_meta_remove(struct connectdata *conn, const char *key)
|
||||
{
|
||||
Curl_hash_delete(&conn->meta_hash, CURL_UNCONST(key), strlen(key) + 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue