mirror of
https://github.com/curl/curl.git
synced 2026-07-02 19:47:16 +03:00
metahash: add asserts to help analyzers
Where NULL pointers are not acceptable input. Closes #17268
This commit is contained in:
parent
255aac56f9
commit
cf38e0067c
3 changed files with 6 additions and 3 deletions
|
|
@ -1390,6 +1390,7 @@ CURLcode curl_easy_ssls_export(CURL *d,
|
|||
CURLcode Curl_meta_set(struct Curl_easy *data, const char *key,
|
||||
void *meta_data, Curl_meta_dtor *meta_dtor)
|
||||
{
|
||||
DEBUGASSERT(meta_data); /* never set to NULL */
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -4412,7 +4412,7 @@ static CURLcode ftp_setup_connection(struct Curl_easy *data,
|
|||
|
||||
ftp = calloc(1, sizeof(*ftp));
|
||||
if(!ftp ||
|
||||
Curl_meta_set(data, CURL_META_FTP_EASY, ftp, ftp_easy_dtor))
|
||||
Curl_meta_set(data, CURL_META_FTP_EASY, ftp, ftp_easy_dtor))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
ftpc = calloc(1, sizeof(*ftpc));
|
||||
|
|
|
|||
|
|
@ -1534,6 +1534,7 @@ static void pop3_easy_dtor(void *key, size_t klen, void *entry)
|
|||
struct POP3 *pop3 = entry;
|
||||
(void)key;
|
||||
(void)klen;
|
||||
DEBUGASSERT(pop3);
|
||||
/* Cleanup our per-request based variables */
|
||||
Curl_safefree(pop3->id);
|
||||
Curl_safefree(pop3->custom);
|
||||
|
|
@ -1545,6 +1546,7 @@ static void pop3_conn_dtor(void *key, size_t klen, void *entry)
|
|||
struct pop3_conn *pop3c = entry;
|
||||
(void)key;
|
||||
(void)klen;
|
||||
DEBUGASSERT(pop3c);
|
||||
Curl_pp_disconnect(&pop3c->pp);
|
||||
Curl_safefree(pop3c->apoptimestamp);
|
||||
free(pop3c);
|
||||
|
|
@ -1556,12 +1558,12 @@ static CURLcode pop3_setup_connection(struct Curl_easy *data,
|
|||
struct pop3_conn *pop3c;
|
||||
struct POP3 *pop3 = calloc(1, sizeof(*pop3));
|
||||
if(!pop3 ||
|
||||
Curl_meta_set(data, CURL_META_POP3_EASY, pop3, pop3_easy_dtor))
|
||||
Curl_meta_set(data, CURL_META_POP3_EASY, pop3, pop3_easy_dtor))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
pop3c = calloc(1, sizeof(*pop3c));
|
||||
if(!pop3c ||
|
||||
Curl_conn_meta_set(conn, CURL_META_POP3_CONN, pop3c, pop3_conn_dtor))
|
||||
Curl_conn_meta_set(conn, CURL_META_POP3_CONN, pop3c, pop3_conn_dtor))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
return CURLE_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue