aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2014-01-31 00:05:36 +0100
committerDan Fandrich <dan@coneharvesters.com>2014-01-31 00:05:36 +0100
commit0f213fdca1652b115998dd8cf0d0e3f260500594 (patch)
tree313d0433e1352470932f17bc03fc9d71411d78c8 /lib
parentbe9cc620b5d658e12b2b0c04c43851b6ad114744 (diff)
pipeline: Fixed a NULL pointer dereference on OOM
Diffstat (limited to 'lib')
-rw-r--r--lib/pipeline.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/pipeline.c b/lib/pipeline.c
index dfa3c7af1..8d2544b83 100644
--- a/lib/pipeline.c
+++ b/lib/pipeline.c
@@ -201,11 +201,18 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
char *port;
struct site_blacklist_entry *entry;
- entry = malloc(sizeof(struct site_blacklist_entry));
-
hostname = strdup(*sites);
- if(!hostname)
+ if(!hostname) {
+ Curl_llist_destroy(new_list, NULL);
+ 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, ':');
if(port) {
@@ -220,8 +227,11 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
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;
+ }
sites++;
}