mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-29 23:19:20 +08:00
mdbx: исправление отрытия таблицы с пустым/нулевым именем и устранение SIGSEGV
при её закрытии.
This commit is contained in:
parent
03077773cb
commit
3d6e196422
@ -472,14 +472,11 @@ static int dbi_open_locked(MDBX_txn *txn, unsigned user_flags, MDBX_dbi *dbi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Done here so we cannot fail after creating a new DB */
|
/* Done here so we cannot fail after creating a new DB */
|
||||||
void *clone = nullptr;
|
defer_free_item_t *const clone = osal_malloc(dbi_namelen(name));
|
||||||
if (name.iov_len) {
|
|
||||||
clone = osal_malloc(dbi_namelen(name));
|
|
||||||
if (unlikely(!clone))
|
if (unlikely(!clone))
|
||||||
return MDBX_ENOMEM;
|
return MDBX_ENOMEM;
|
||||||
name.iov_base = memcpy(clone, name.iov_base, name.iov_len);
|
memcpy(clone, name.iov_base, name.iov_len);
|
||||||
} else
|
name.iov_base = clone;
|
||||||
name.iov_base = "";
|
|
||||||
|
|
||||||
uint8_t dbi_state = DBI_LINDO | DBI_VALID | DBI_FRESH;
|
uint8_t dbi_state = DBI_LINDO | DBI_VALID | DBI_FRESH;
|
||||||
if (unlikely(rc)) {
|
if (unlikely(rc)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user