Browse Source

Remove last reference to struct work used outside the sshare_lock in submit_work_thread

Con Kolivas 13 years ago
parent
commit
7551b88d00
1 changed files with 3 additions and 2 deletions
  1. 3 2
      cgminer.c

+ 3 - 2
cgminer.c

@@ -3149,7 +3149,7 @@ static void *submit_work_thread(void *userdata)
 
 
 	if (work->stratum) {
 	if (work->stratum) {
 		struct stratum_share *sshare = calloc(sizeof(struct stratum_share), 1);
 		struct stratum_share *sshare = calloc(sizeof(struct stratum_share), 1);
-		uint32_t *hash32 = (uint32_t *)work->hash, nonce;
+		uint32_t *hash32 = (uint32_t *)work->hash, h32, nonce;
 		char *noncehex;
 		char *noncehex;
 		char s[1024];
 		char s[1024];
 
 
@@ -3165,10 +3165,11 @@ static void *submit_work_thread(void *userdata)
 		memset(s, 0, 1024);
 		memset(s, 0, 1024);
 		sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
 		sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
 			pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
 			pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
+		h32 = hash32[6];
 		mutex_unlock(&sshare_lock);
 		mutex_unlock(&sshare_lock);
 		free(noncehex);
 		free(noncehex);
 
 
-		applog(LOG_INFO, "Submitting share %08lx to pool %d", (unsigned long)(hash32[6]), pool->pool_no);
+		applog(LOG_INFO, "Submitting share %08lx to pool %d", h32, pool->pool_no);
 
 
 		if (likely(stratum_send(pool, s, strlen(s)))) {
 		if (likely(stratum_send(pool, s, strlen(s)))) {
 			if (pool_tclear(pool, &pool->submit_fail))
 			if (pool_tclear(pool, &pool->submit_fail))