Browse Source

Check against NULL pointers getting into curlring

Luke Dashjr 13 years ago
parent
commit
92c08767f8
1 changed files with 3 additions and 1 deletions
  1. 3 1
      cgminer.c

+ 3 - 1
cgminer.c

@@ -1985,7 +1985,7 @@ static void recruit_curl(struct pool *pool)
 	struct curl_ent *ce = calloc(sizeof(struct curl_ent), 1);
 
 	ce->curl = curl_easy_init();
-	if (unlikely(!ce->curl || !ce))
+	if (unlikely(!ce || !ce->curl))
 		quit(1, "Failed to init in recruit_curl");
 
 	list_add(&ce->node, &pool->curlring);
@@ -2019,6 +2019,8 @@ static struct curl_ent *pop_curl_entry(struct pool *pool)
 static void push_curl_entry(struct curl_ent *ce, struct pool *pool)
 {
 	mutex_lock(&pool->pool_lock);
+	if (!ce || !ce->curl)
+		quit(1, "Attempted to add NULL in push_curl_entry");
 	list_add_tail(&ce->node, &pool->curlring);
 	gettimeofday(&ce->tv, NULL);
 	pthread_cond_signal(&pool->cr_cond);