|
@@ -2343,13 +2343,15 @@ static void get_benchmark_work(struct work *work)
|
|
|
work->pool = pools[0];
|
|
work->pool = pools[0];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void clear_work(struct work *);
|
|
|
|
|
+
|
|
|
static char *prepare_rpc_req(struct work *work, enum pool_protocol proto, const char *lpid)
|
|
static char *prepare_rpc_req(struct work *work, enum pool_protocol proto, const char *lpid)
|
|
|
{
|
|
{
|
|
|
char *rpc_req;
|
|
char *rpc_req;
|
|
|
|
|
|
|
|
|
|
+ clear_work(work);
|
|
|
switch (proto) {
|
|
switch (proto) {
|
|
|
case PLP_GETWORK:
|
|
case PLP_GETWORK:
|
|
|
- work->tmpl = NULL;
|
|
|
|
|
return strdup(getwork_rpc_req);
|
|
return strdup(getwork_rpc_req);
|
|
|
case PLP_GETBLOCKTEMPLATE:
|
|
case PLP_GETBLOCKTEMPLATE:
|
|
|
work->tmpl_refcount = malloc(sizeof(*work->tmpl_refcount));
|
|
work->tmpl_refcount = malloc(sizeof(*work->tmpl_refcount));
|
|
@@ -2486,7 +2488,7 @@ static struct work *make_work(void)
|
|
|
return work;
|
|
return work;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void free_work(struct work *work)
|
|
|
|
|
|
|
+static void clear_work(struct work *work)
|
|
|
{
|
|
{
|
|
|
if (work->tmpl) {
|
|
if (work->tmpl) {
|
|
|
struct pool *pool = work->pool;
|
|
struct pool *pool = work->pool;
|
|
@@ -2496,8 +2498,15 @@ static void free_work(struct work *work)
|
|
|
if (free_tmpl) {
|
|
if (free_tmpl) {
|
|
|
blktmpl_free(work->tmpl);
|
|
blktmpl_free(work->tmpl);
|
|
|
free(work->tmpl_refcount);
|
|
free(work->tmpl_refcount);
|
|
|
|
|
+ work->tmpl = NULL;
|
|
|
|
|
+ work->tmpl_refcount = NULL;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void free_work(struct work *work)
|
|
|
|
|
+{
|
|
|
|
|
+ clear_work(work);
|
|
|
free(work);
|
|
free(work);
|
|
|
}
|
|
}
|
|
|
|
|
|