Browse Source

safer

djm34
Jan Berdajs 11 years ago
parent
commit
8f53b7c86c
  1. 8
      sgminer.c

8
sgminer.c

@ -8119,7 +8119,7 @@ static void restart_mining_threads(unsigned int new_n_threads)
if (!mining_thr) if (!mining_thr)
quit(1, "Failed to calloc mining_thr"); quit(1, "Failed to calloc mining_thr");
for (i = 0; i < mining_threads; i++) { for (i = 0; i < mining_threads; i++) {
mining_thr[i] = (struct thr_info *)calloc(1, sizeof(*thr)); mining_thr[i] = (struct thr_info *)calloc(1, sizeof(struct thr_info));
if (!mining_thr[i]) if (!mining_thr[i])
quit(1, "Failed to calloc mining_thr[%d]", i); quit(1, "Failed to calloc mining_thr[%d]", i);
} }
@ -8143,7 +8143,7 @@ static void restart_mining_threads(unsigned int new_n_threads)
continue; continue;
} }
cgpu->thr = (struct thr_info **)malloc(sizeof(*cgpu->thr) * (cgpu->threads+1)); cgpu->thr = (struct thr_info **)malloc(sizeof(struct thr_info *) * (cgpu->threads+1));
cgpu->thr[cgpu->threads] = NULL; cgpu->thr[cgpu->threads] = NULL;
cgpu->status = LIFE_INIT; cgpu->status = LIFE_INIT;
@ -8159,10 +8159,12 @@ static void restart_mining_threads(unsigned int new_n_threads)
cgtime(&thr->last); cgtime(&thr->last);
cgpu->thr[j] = thr; cgpu->thr[j] = thr;
if (!cgpu->drv->thread_prepare(thr)) if (!cgpu->drv->thread_prepare(thr)) {
applog(LOG_ERR, "thread_prepare failed for thread %d", thr->id);
continue; continue;
} }
} }
}
rd_unlock(&devices_lock); rd_unlock(&devices_lock);
wr_unlock(&mining_thr_lock); wr_unlock(&mining_thr_lock);

Loading…
Cancel
Save