From cce15501547ddc32bd03f57075784fb4f156fa89 Mon Sep 17 00:00:00 2001 From: Thomas Jahns <jahns@dkrz.de> Date: Sat, 9 Feb 2019 03:43:20 +0100 Subject: [PATCH] Fix resource leak. --- src/resource_handle.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/resource_handle.c b/src/resource_handle.c index 20ced5f8c..eabb48065 100644 --- a/src/resource_handle.c +++ b/src/resource_handle.c @@ -426,13 +426,18 @@ void reshDestroy(cdiResH resH) nspT = namespaceResHDecode ( resH ); + listElem_t *r = resHList[nsp].resources + nspT.idx; + xassert ( nspT.nsp == nsp && nspT.idx >= 0 && nspT.idx < resHList[nsp].size - && resHList[nsp].resources[nspT.idx].res.v.ops); + && r->res.v.ops); - if (resHList[nsp].resources[nspT.idx].status & RESH_IN_USE_BIT) - reshRemove_(nsp, nspT.idx, __func__); + if (r->status & RESH_IN_USE_BIT) + { + r->res.v.ops->valDestroy(r->res.v.val); + reshRemove_(nsp, nspT.idx, __func__); + } LIST_UNLOCK(); } -- GitLab