From 710e316577522d785dfd67023a47d800c7a4ef77 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 2 Dec 2016 14:00:01 +1100 Subject: [PATCH] Clear proxy workbases on freeing the proxy. --- src/stratifier.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index c4e96cc1..a6cf5ea5 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2760,6 +2760,7 @@ static void free_proxy(proxy_t *proxy) /* Delete any shares in the proxy's hashtable. */ if (dsdata) { share_t *share, *tmpshare; + workbase_t *wb, *tmpwb; mutex_lock(&dsdata->share_lock); HASH_ITER(hh, dsdata->shares, share, tmpshare) { @@ -2767,6 +2768,13 @@ static void free_proxy(proxy_t *proxy) dealloc(share); } mutex_unlock(&dsdata->share_lock); + + ck_wlock(&dsdata->workbase_lock); + HASH_ITER(hh, dsdata->workbases, wb, tmpwb) { + HASH_DEL(dsdata->workbases, wb); + clear_workbase(wb); + } + ck_wunlock(&dsdata->workbase_lock); } free(proxy->sdata);