From 6f905932af54ee04c42827974b193ba3d696bf46 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 27 Jul 2011 08:32:25 +1000 Subject: [PATCH] Only free the thread structures if the thread still exists. --- main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index f759af5f..a84550ba 100644 --- a/main.c +++ b/main.c @@ -3149,15 +3149,16 @@ static void *reinit_gpu(void *userdata) thr = &thr_info[thr_id]; thr->rolling = thr->cgpu->rolling = 0; tq_freeze(thr->q); - if (!pthread_cancel(*thr->pth)) + if (!pthread_cancel(*thr->pth)) { pthread_join(*thr->pth, NULL); - free(thr->q); + free(thr->q); + free(clStates[thr_id]); + } + thr->q = tq_new(); if (!thr->q) quit(1, "Failed to tq_new in reinit_gputhread"); - free(clStates[thr_id]); - applog(LOG_INFO, "Reinit GPU thread %d", thr_id); clStates[thr_id] = initCl(gpu, name, sizeof(name)); if (!clStates[thr_id]) {