From: Victor Julien Date: Mon, 7 Sep 2020 08:25:37 +0000 (+0200) Subject: datasets: free old data when reusing a hash container X-Git-Tag: suricata-5.0.9~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31cd7401cb1e7e7fd6671b4b21bf837f370006b2;p=thirdparty%2Fsuricata.git datasets: free old data when reusing a hash container (cherry picked from commit 017c038bcba9ebe279e470cc48e1f440dfa0ef7d) --- diff --git a/src/util-thash.c b/src/util-thash.c index f5c9db145c..395336c256 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -753,6 +753,9 @@ static THashData *THashGetUsed(THashTableContext *ctx) h->prev = NULL; HRLOCK_UNLOCK(hb); + if (h->data != NULL) { + ctx->config.DataFree(h->data); + } SCMutexUnlock(&h->m); (void) SC_ATOMIC_ADD(ctx->prune_idx, (ctx->config.hash_size - cnt));