1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

pipeline: Fixed a NULL pointer dereference on OOM

This commit is contained in:
Dan Fandrich 2014-01-31 00:05:36 +01:00
parent be9cc620b5
commit 0f213fdca1

View File

@ -201,11 +201,18 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
char *port; char *port;
struct site_blacklist_entry *entry; struct site_blacklist_entry *entry;
entry = malloc(sizeof(struct site_blacklist_entry));
hostname = strdup(*sites); hostname = strdup(*sites);
if(!hostname) if(!hostname) {
Curl_llist_destroy(new_list, NULL);
return CURLM_OUT_OF_MEMORY; return CURLM_OUT_OF_MEMORY;
}
entry = malloc(sizeof(struct site_blacklist_entry));
if(!entry) {
free(hostname);
Curl_llist_destroy(new_list, NULL);
return CURLM_OUT_OF_MEMORY;
}
port = strchr(hostname, ':'); port = strchr(hostname, ':');
if(port) { if(port) {
@ -220,8 +227,11 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
entry->hostname = hostname; entry->hostname = hostname;
if(!Curl_llist_insert_next(new_list, new_list->tail, entry)) if(!Curl_llist_insert_next(new_list, new_list->tail, entry)) {
site_blacklist_llist_dtor(NULL, entry);
Curl_llist_destroy(new_list, NULL);
return CURLM_OUT_OF_MEMORY; return CURLM_OUT_OF_MEMORY;
}
sites++; sites++;
} }