mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 05:38:20 +08:00
mdbx: remove created file if mdbx_env_copy() failed.
Change-Id: Ie47981b6031c6e7099a5d49f6cd7338ab2c1e040
This commit is contained in:
parent
797bcf9aca
commit
e57d4bbb00
@ -10565,15 +10565,17 @@ int __cold mdbx_env_copy(MDBX_env *env, const char *dest_path, unsigned flags) {
|
||||
rc = mdbx_env_copy2fd(env, newfd, flags);
|
||||
}
|
||||
|
||||
if (dxb_pathname != dest_path)
|
||||
free(dxb_pathname);
|
||||
|
||||
if (newfd != INVALID_HANDLE_VALUE) {
|
||||
int err = mdbx_closefile(newfd);
|
||||
if (rc == MDBX_SUCCESS && err != rc)
|
||||
rc = err;
|
||||
if (rc != MDBX_SUCCESS)
|
||||
(void)mdbx_removefile(dxb_pathname);
|
||||
}
|
||||
|
||||
if (dxb_pathname != dest_path)
|
||||
free(dxb_pathname);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user