iprep: cleanup ctx on shutdown

~~Dr.M~~ Error #1: LEAK 480 direct bytes 0x0aae7fc0-0x0aae81a0 + 0 indirect bytes
~~Dr.M~~ # 0 replace_malloc                    [/work/drmemory_package/common/alloc_replace.c:2373]
~~Dr.M~~ # 1 SRepInit                          [.../Suricata/src/reputation.c:594]
~~Dr.M~~ # 2 DetectEngineCtxInit               [.../src/detect-engine.c:844]
~~Dr.M~~ # 3 main                              [.../Suricata/src/suricata.c:2230]
pull/1186/merge
Victor Julien 11 years ago
parent b2b1239ddf
commit 033409a042

@ -916,6 +916,7 @@ void DetectEngineCtxFree(DetectEngineCtx *de_ctx)
}
DetectEngineCtxFreeThreadKeywordData(de_ctx);
SRepDestroy(de_ctx);
SCFree(de_ctx);
//DetectAddressGroupPrintMemory();
//DetectSigGroupPrintMemory();

@ -664,6 +664,26 @@ int SRepInit(DetectEngineCtx *de_ctx)
return 0;
}
void SRepDestroy(DetectEngineCtx *de_ctx) {
if (de_ctx->srepCIDR_ctx != NULL) {
int i;
for (i = 0; i < SREP_MAX_CATS; i++) {
if (de_ctx->srepCIDR_ctx->srepIPV4_tree[i] != NULL) {
SCRadixReleaseRadixTree(de_ctx->srepCIDR_ctx->srepIPV4_tree[i]);
de_ctx->srepCIDR_ctx->srepIPV4_tree[i] = NULL;
}
if (de_ctx->srepCIDR_ctx->srepIPV6_tree[i] != NULL) {
SCRadixReleaseRadixTree(de_ctx->srepCIDR_ctx->srepIPV6_tree[i]);
de_ctx->srepCIDR_ctx->srepIPV6_tree[i] = NULL;
}
}
SCFree(de_ctx->srepCIDR_ctx);
de_ctx->srepCIDR_ctx = NULL;
}
}
#ifdef UNITTESTS
#include "conf-yaml-loader.h"

@ -42,6 +42,7 @@ typedef struct SReputation_ {
uint8_t SRepCatGetByShortname(char *shortname);
int SRepInit(struct DetectEngineCtx_ *de_ctx);
void SRepDestroy(struct DetectEngineCtx_ *de_ctx);
void SRepReloadComplete(void);
int SRepHostTimedOut(Host *);

Loading…
Cancel
Save