valgrind memcheck: fix a b3g mem leak at shutdown.

remotes/origin/master-1.0.x
Victor Julien 17 years ago
parent c5b2b8c082
commit 25f696106c

@ -1003,6 +1003,19 @@ void B3gDestroyCtx(MpmCtx *mpm_ctx) {
mpm_ctx->memory_cnt--;
mpm_ctx->memory_size -= (sizeof(B3gHashItem) * ctx->scan_hash_size);
}
if (ctx->scan_hash2) {
int h;
for (h = 0; h < ctx->scan_hash_size; h++) {
if (ctx->scan_hash2[h] == NULL)
continue;
B3gHashFree(mpm_ctx, ctx->scan_hash2[h]);
}
free(ctx->scan_hash2);
mpm_ctx->memory_cnt--;
mpm_ctx->memory_size -= (sizeof(B3gHashItem) * ctx->scan_hash_size);
}
if (ctx->search_bloom) {
int h;
@ -1035,6 +1048,19 @@ void B3gDestroyCtx(MpmCtx *mpm_ctx) {
mpm_ctx->memory_cnt--;
mpm_ctx->memory_size -= (sizeof(B3gHashItem) * ctx->search_hash_size);
}
if (ctx->search_hash2) {
int h;
for (h = 0; h < ctx->search_hash_size; h++) {
if (ctx->search_hash2[h] == NULL)
continue;
B3gHashFree(mpm_ctx, ctx->search_hash2[h]);
}
free(ctx->search_hash2);
mpm_ctx->memory_cnt--;
mpm_ctx->memory_size -= (sizeof(B3gHashItem) * ctx->search_hash_size);
}
if (ctx->scan_pminlen) {
free(ctx->scan_pminlen);

Loading…
Cancel
Save