Browse Source

Bugfix: Increment work->pool->staged inside of mutex to avoid work being freed (and staged decremented) before we dereference it

Luke Dashjr 13 years ago
parent
commit
4b758963b7
1 changed files with 1 additions and 2 deletions
  1. 1 2
      cgminer.c

+ 1 - 2
cgminer.c

@@ -2929,6 +2929,7 @@ static bool hash_push(struct work *work)
 	}
 
 	mutex_lock(stgd_lock);
+	work->pool->staged++;
 	if (work_rollable(work))
 		staged_rollable++;
 	if (likely(!getq->frozen)) {
@@ -2939,8 +2940,6 @@ static bool hash_push(struct work *work)
 	pthread_cond_signal(&getq->cond);
 	mutex_unlock(stgd_lock);
 
-	work->pool->staged++;
-
 	if (dec)
 		dec_queued(work->pool);