diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dbwrap/dbwrap_cache.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/dbwrap/dbwrap_cache.c b/lib/dbwrap/dbwrap_cache.c index d97242ebdc..6c6b795a41 100644 --- a/lib/dbwrap/dbwrap_cache.c +++ b/lib/dbwrap/dbwrap_cache.c @@ -32,15 +32,27 @@ struct db_cache_ctx { static bool dbwrap_cache_validate(struct db_cache_ctx *ctx) { - if (ctx->seqnum == dbwrap_get_seqnum(ctx->backing)) { + int backing_seqnum; + + backing_seqnum = dbwrap_get_seqnum(ctx->backing); + if (backing_seqnum == ctx->seqnum) { return true; } + TALLOC_FREE(ctx->positive); ctx->positive = db_open_rbt(ctx); + if (ctx->positive == NULL) { + return false; + } + TALLOC_FREE(ctx->negative); ctx->negative = db_open_rbt(ctx); + if (ctx->negative == NULL) { + return false; + } - return ((ctx->positive != NULL) && (ctx->negative != NULL)); + ctx->seqnum = backing_seqnum; + return true; } static NTSTATUS dbwrap_cache_parse_record( |