From b2106b3aed398e92aeab63c931b30d608aafb1a8 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 6 Apr 2013 11:18:21 +1100 Subject: [PATCH] Free avalon->works in the event we call avalon_prepare on failure to initialise. --- driver-avalon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/driver-avalon.c b/driver-avalon.c index 973b1759..d0087b76 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -645,10 +645,14 @@ static bool avalon_prepare(struct thr_info *thr) struct avalon_info *info = avalon_infos[avalon->device_id]; struct timeval now; + free(avalon->works); avalon->works = calloc(info->miner_count * sizeof(struct work *), 4); if (!avalon->works) quit(1, "Failed to calloc avalon works in avalon_prepare"); - __avalon_init(avalon); + if (avalon->device_fd == -1) + avalon_init(avalon); + else + __avalon_init(avalon); gettimeofday(&now, NULL); get_datestamp(avalon->init, &now);