mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +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 */
|
||||
void *clone = nullptr;
|
||||
if (name.iov_len) {
|
||||
clone = osal_malloc(dbi_namelen(name));
|
||||
defer_free_item_t *const clone = osal_malloc(dbi_namelen(name));
|
||||
if (unlikely(!clone))
|
||||
return MDBX_ENOMEM;
|
||||
name.iov_base = memcpy(clone, name.iov_base, name.iov_len);
|
||||
} else
|
||||
name.iov_base = "";
|
||||
memcpy(clone, name.iov_base, name.iov_len);
|
||||
name.iov_base = clone;
|
||||
|
||||
uint8_t dbi_state = DBI_LINDO | DBI_VALID | DBI_FRESH;
|
||||
if (unlikely(rc)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user