From da024f69cc96bc003c55c08de49f03d31cdea439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=B6?= Date: Thu, 19 Nov 2015 11:20:22 +0530 Subject: [PATCH] Cleanup in journal_open() correctly (#41129) (cherry picked from commit 65f6e2f909cfa4ab9c52ea9a5b12976a186a6a25) (cherry picked from commit 264d7653dde597f583b99a4cd803738e344771ac) --- lib/dns/journal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 4811ebbd80..102efd16f8 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -677,11 +677,12 @@ journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t writable, failure: j->magic = 0; - if (j->index != NULL) { - isc_mem_put(j->mctx, j->index, j->header.index_size * + if (j->rawindex != NULL) + isc_mem_put(j->mctx, j->rawindex, j->header.index_size * sizeof(journal_rawpos_t)); - j->index = NULL; - } + if (j->index != NULL) + isc_mem_put(j->mctx, j->index, j->header.index_size * + sizeof(journal_pos_t)); if (j->filename != NULL) isc_mem_free(j->mctx, j->filename); if (j->fp != NULL)