alert: fixes leak in ThresholdHandlePacketRule

ThresholdHandlePacketRule may take ownership of an allocated
DetectThresholdEntry, and places it in a position of the
array th_entry. But it never got released
pull/6449/head
Philippe Antoine 4 years ago committed by Victor Julien
parent d21a252238
commit 6fadb97d5d

@ -727,8 +727,14 @@ void ThresholdHashAllocate(DetectEngineCtx *de_ctx)
*/
void ThresholdContextDestroy(DetectEngineCtx *de_ctx)
{
if (de_ctx->ths_ctx.th_entry != NULL)
if (de_ctx->ths_ctx.th_entry != NULL) {
for (uint32_t i = 0; i < de_ctx->ths_ctx.th_size; i++) {
if (de_ctx->ths_ctx.th_entry[i] != NULL) {
SCFree(de_ctx->ths_ctx.th_entry[i]);
}
}
SCFree(de_ctx->ths_ctx.th_entry);
}
SCMutexDestroy(&de_ctx->ths_ctx.threshold_table_lock);
}

Loading…
Cancel
Save