Skip to content
Snippets Groups Projects
Commit 6689f511 authored by Georgiy Lebedev's avatar Georgiy Lebedev Committed by Vladimir Davydov
Browse files

box: fix memory leaks on `ER_MULTISTATEMENT_TRANSACTION` in DDL

Space index build and space format checking operations don't destroy space
iterator on `txn_check_singlestatement` failure — fix this.

Closes #8773

NO_DOC=bugfix
NO_TEST=<leak happens in small, cannot be detected by sanitizer>
parent 7135910e
No related branches found
No related tags found
No related merge requests found
## bugfix/box
* Fixed the memory leaks caused by the multi-statement transaction errors in the
space index building and the space format checking operations (gh-8773).
......@@ -974,11 +974,11 @@ memtx_space_check_format(struct space *space, struct tuple_format *format)
if (index_size(pk) == 0)
return 0;
struct iterator *it = index_create_iterator(pk, ITER_ALL, NULL, 0);
if (it == NULL)
if (txn_check_singlestatement(txn, "space format check") != 0)
return -1;
if (txn_check_singlestatement(txn, "space format check") != 0)
struct iterator *it = index_create_iterator(pk, ITER_ALL, NULL, 0);
if (it == NULL)
return -1;
struct memtx_engine *memtx = (struct memtx_engine *)space->engine;
......@@ -1224,6 +1224,9 @@ memtx_space_build_index(struct space *src_space, struct index *new_index,
return -1;
}
if (txn_check_singlestatement(txn, "index build") != 0)
return -1;
/* Now deal with any kind of add index during normal operation. */
struct iterator *it = index_create_iterator(pk, ITER_ALL, NULL, 0);
if (it == NULL)
......@@ -1237,9 +1240,6 @@ memtx_space_build_index(struct space *src_space, struct index *new_index,
*/
bool can_yield = pk->def->type != HASH;
if (txn_check_singlestatement(txn, "index build") != 0)
return -1;
struct memtx_engine *memtx = (struct memtx_engine *)src_space->engine;
struct memtx_ddl_state state;
struct trigger on_replace;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment