mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:24:12 +08:00
lmdb: fix segfault in mdb_chk when mdb_env_open() failed.
Change-Id: If72d35518c2d4dd33d284049e00fc633e65ee52c
This commit is contained in:
parent
65555273aa
commit
ad8c4a19bb
6
mdb.c
6
mdb.c
@ -2575,8 +2575,12 @@ mdb_env_sync(MDB_env *env, int force)
|
|||||||
int rc;
|
int rc;
|
||||||
pthread_mutex_t *mutex;
|
pthread_mutex_t *mutex;
|
||||||
MDB_meta *head;
|
MDB_meta *head;
|
||||||
unsigned flags = env->me_flags & ~MDB_NOMETASYNC;
|
unsigned flags;
|
||||||
|
|
||||||
|
if (unlikely(! env || ! env->me_txns))
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
flags = env->me_flags & ~MDB_NOMETASYNC;
|
||||||
if (unlikely(flags & (MDB_RDONLY | MDB_FATAL_ERROR)))
|
if (unlikely(flags & (MDB_RDONLY | MDB_FATAL_ERROR)))
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
|
||||||
|
@ -755,7 +755,8 @@ bailout:
|
|||||||
mdb_txn_abort(txn);
|
mdb_txn_abort(txn);
|
||||||
if (locktxn)
|
if (locktxn)
|
||||||
mdb_txn_abort(locktxn);
|
mdb_txn_abort(locktxn);
|
||||||
mdb_env_close(env);
|
if (env)
|
||||||
|
mdb_env_close(env);
|
||||||
free(pagemap);
|
free(pagemap);
|
||||||
if (rc)
|
if (rc)
|
||||||
return EXIT_FAILURE + 2;
|
return EXIT_FAILURE + 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user