Skip to content

Commit 7733d63

Browse files
committed
MDEV-36758: always release ctx in mhnsw_delete_all
Fixes leak of shared context.
1 parent 9a4a30a commit 7733d63

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

mysql-test/main/vector2.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,12 @@ select * from t;
453453
v
454454
1111
455455
drop table t;
456+
#
457+
# MDEV-36758 - LeakSanitizer errors in MHNSW_Share::alloc_node after DML on empty table with vector key
458+
#
459+
create table t (v vector(1) not null, vector(v)) engine=myisam;
460+
delete from t;
461+
insert into t values (0x31313131);
462+
delete from t;
463+
drop table t;
456464
# End of 11.8 tests

mysql-test/main/vector2.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,13 @@ set statement sql_mode='' for alter table t modify v vector(1);
331331
select * from t;
332332
drop table t;
333333

334+
--echo #
335+
--echo # MDEV-36758 - LeakSanitizer errors in MHNSW_Share::alloc_node after DML on empty table with vector key
336+
--echo #
337+
create table t (v vector(1) not null, vector(v)) engine=myisam;
338+
delete from t;
339+
insert into t values (0x31313131);
340+
delete from t;
341+
drop table t;
342+
334343
--echo # End of 11.8 tests

sql/vector_mhnsw.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,9 +1546,9 @@ int mhnsw_delete_all(TABLE *table, KEY *keyinfo, bool truncate)
15461546
if (!MHNSW_Share::acquire(&ctx, table, true))
15471547
{
15481548
ctx->reset(table->s);
1549-
ctx->release(table);
15501549
}
15511550

1551+
ctx->release(table);
15521552
return 0;
15531553
}
15541554

0 commit comments

Comments
 (0)