mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 13:04:29 +00:00
Revert "Copy the work before returning from creating a thread in case we change the work before copying it."
This reverts commit 6bf4d781e9d9620779d3fb924037941929e738c9. Causing a double free error.
This commit is contained in:
parent
0f782ba6bd
commit
52e521a7c1
10
main.c
10
main.c
@ -3088,7 +3088,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool submit_work_sync(struct thr_info *thr, struct work *work_in)
|
static bool submit_work_sync(struct thr_info *thr, const struct work *work_in)
|
||||||
{
|
{
|
||||||
struct workio_cmd *wc;
|
struct workio_cmd *wc;
|
||||||
|
|
||||||
@ -3099,9 +3099,10 @@ static bool submit_work_sync(struct thr_info *thr, struct work *work_in)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wc->u.work = work_in;
|
wc->u.work = make_work();
|
||||||
wc->cmd = WC_SUBMIT_WORK;
|
wc->cmd = WC_SUBMIT_WORK;
|
||||||
wc->thr = thr;
|
wc->thr = thr;
|
||||||
|
memcpy(wc->u.work, work_in, sizeof(*work_in));
|
||||||
|
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "Pushing submit work to work thread");
|
applog(LOG_DEBUG, "Pushing submit work to work thread");
|
||||||
@ -3120,7 +3121,7 @@ err_out:
|
|||||||
|
|
||||||
struct swa {
|
struct swa {
|
||||||
struct thr_info *thr;
|
struct thr_info *thr;
|
||||||
struct work *work_in;
|
const struct work *work_in;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *swasync_thread(void *userdata)
|
static void *swasync_thread(void *userdata)
|
||||||
@ -3145,8 +3146,7 @@ static bool submit_work_async(struct thr_info *thr, const struct work *work_in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
swa->thr = thr;
|
swa->thr = thr;
|
||||||
swa->work_in = make_work();
|
swa->work_in = work_in;
|
||||||
memcpy(swa->work_in, work_in, sizeof(struct work));
|
|
||||||
|
|
||||||
if (unlikely(pthread_create(&sw_thread, NULL, swasync_thread, (void *)swa))) {
|
if (unlikely(pthread_create(&sw_thread, NULL, swasync_thread, (void *)swa))) {
|
||||||
applog(LOG_ERR, "Failed to create swasync_thread");
|
applog(LOG_ERR, "Failed to create swasync_thread");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user