From 3471b299c070c8dab56f15c55cebce38b55ee161 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 2 Dec 2016 13:50:12 +1100 Subject: [PATCH] Delete any shares in a proxy's share hashtable on freeing it. --- src/stratifier.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index b3e69549..c4e96cc1 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2755,6 +2755,20 @@ static void generator_drop_proxy(ckpool_t *ckp, const int64_t id, const int subi static void free_proxy(proxy_t *proxy) { + sdata_t *dsdata = proxy->sdata; + + /* Delete any shares in the proxy's hashtable. */ + if (dsdata) { + share_t *share, *tmpshare; + + mutex_lock(&dsdata->share_lock); + HASH_ITER(hh, dsdata->shares, share, tmpshare) { + HASH_DEL(dsdata->shares, share); + dealloc(share); + } + mutex_unlock(&dsdata->share_lock); + } + free(proxy->sdata); free(proxy); }