From c5eb3c75af40f413b73efd05c6acd29e529ec0cd Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 7 Aug 2014 10:59:10 +1000 Subject: [PATCH] Allocate the gbt data from within live_server --- src/generator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/generator.c b/src/generator.c index e2d3d2a4..5acc3227 100644 --- a/src/generator.c +++ b/src/generator.c @@ -153,7 +153,8 @@ retry: keep_sockalive(cs->fd); /* Test we can connect, authorise and get a block template */ - gbt = si->data; + gbt = ckzalloc(sizeof(gbtbase_t)); + si->data = gbt; if (!gen_gbtbase(cs, gbt)) { LOGINFO("Failed to get test block template from %s:%s!", cs->url, cs->port); @@ -1298,15 +1299,11 @@ static int server_mode(ckpool_t *ckp, proc_instance_t *pi) ckp->servers = ckalloc(sizeof(server_instance_t *) * ckp->btcds); for (i = 0; i < ckp->btcds; i++) { - gbtbase_t *gbt; - ckp->servers[i] = ckzalloc(sizeof(server_instance_t)); si = ckp->servers[i]; si->url = ckp->btcdurl[i]; si->auth = ckp->btcdauth[i]; si->pass = ckp->btcdpass[i]; - gbt = ckzalloc(sizeof(gbtbase_t)); - si->data = gbt; } ret = gen_loop(pi);