From bc113b873fd11c4404c1e63726bcf9b787f74df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 3 May 2022 17:49:26 +0300 Subject: MDEV-28465 Some calls to btr_pcur_close() are unnecessary The function btr_pcur_close() is being invoked on local variables even when no cleanup needs to be done. In particular, for B-tree indexes (not SPATIAL INDEX), unless btr_pcur_store_position() was invoked in the past, there is no need to invoke btr_pcur_close(). On purge and rollback, we will retain btr_pcur_close(&pcur) because otherwise some ./mtr --suite=innodb_gis tests would leak memory. --- storage/innobase/fts/fts0fts.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'storage/innobase/fts/fts0fts.cc') diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index c3d076b81d6..fd8826af2c5 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -3494,13 +3494,13 @@ fts_add_doc_by_id( } if (!is_id_cluster) { - btr_pcur_close(doc_pcur); + ut_free(doc_pcur->old_rec_buf); } } func_exit: mtr_commit(&mtr); - btr_pcur_close(&pcur); + ut_free(pcur.old_rec_buf); mem_heap_free(heap); return(TRUE); @@ -3581,7 +3581,6 @@ fts_get_max_doc_id( } func_exit: - btr_pcur_close(&pcur); mtr_commit(&mtr); return(doc_id); } -- cgit v1.2.1