diff options
Diffstat (limited to 'lib/ntdb/open.c')
-rw-r--r-- | lib/ntdb/open.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/ntdb/open.c b/lib/ntdb/open.c index 9de9e9b48c..56c97afe43 100644 --- a/lib/ntdb/open.c +++ b/lib/ntdb/open.c @@ -868,19 +868,19 @@ _PUBLIC_ int ntdb_close(struct ntdb_context *ntdb) ntdb_transaction_cancel(ntdb); } - if (ntdb->file->map_ptr) { - if (ntdb->flags & NTDB_INTERNAL) - ntdb->free_fn(ntdb->file->map_ptr, ntdb->alloc_data); - else - ntdb_munmap(ntdb->file); - } - if (ntdb->file) { - ntdb_lock_cleanup(ntdb); - if (--ntdb->file->refcnt == 0) { - ret = close(ntdb->file->fd); - ntdb->free_fn(ntdb->file->lockrecs, ntdb->alloc_data); - ntdb->free_fn(ntdb->file, ntdb->alloc_data); + ntdb_lock_cleanup(ntdb); + if (--ntdb->file->refcnt == 0) { + if (ntdb->file->map_ptr) { + if (ntdb->flags & NTDB_INTERNAL) { + ntdb->free_fn(ntdb->file->map_ptr, + ntdb->alloc_data); + } else { + ntdb_munmap(ntdb->file); + } } + ret = close(ntdb->file->fd); + ntdb->free_fn(ntdb->file->lockrecs, ntdb->alloc_data); + ntdb->free_fn(ntdb->file, ntdb->alloc_data); } /* Remove from tdbs list */ |