Remove the unqueued work reference when we discard work from get queued as well.
diff --git a/cgminer.c b/cgminer.c
index dc40c91..1305a58 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6379,11 +6379,10 @@ struct work *get_queued(struct cgpu_info *cgpu)
work = NULL;
wake_gws();
goto out_unlock;
- }
- __add_queued(cgpu, work);
+ } else
+ __add_queued(cgpu, work);
cgpu->unqueued_work = NULL;
}
-out_unlock:
wr_unlock(&cgpu->qlock);
return work;