summaryrefslogtreecommitdiff
path: root/storage/innobase/btr/btr0pcur.c
diff options
context:
space:
mode:
authorVasil Dimov <vasil.dimov@oracle.com>2011-12-29 16:12:55 +0200
committerVasil Dimov <vasil.dimov@oracle.com>2011-12-29 16:12:55 +0200
commit93ab1d547dc462f0c723bfdf6a9822afeb6c1df6 (patch)
treefe7e0c1c8d1973369bb141af87d94cbe1a557aa3 /storage/innobase/btr/btr0pcur.c
parentb7b9a4e8102f7be5ac6eca34b9f3f743dc0af100 (diff)
downloadmariadb-git-93ab1d547dc462f0c723bfdf6a9822afeb6c1df6.tar.gz
Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Port vasil.dimov@oracle.com-20111205082831-7v1qu50hvd9hjr3g from mysql-trunk
Diffstat (limited to 'storage/innobase/btr/btr0pcur.c')
-rw-r--r--storage/innobase/btr/btr0pcur.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
index 57d9752649f..fb153556b2f 100644
--- a/storage/innobase/btr/btr0pcur.c
+++ b/storage/innobase/btr/btr0pcur.c
@@ -52,12 +52,13 @@ btr_pcur_create_for_mysql(void)
}
/**************************************************************//**
-Frees the memory for a persistent cursor object. */
+Resets a persistent cursor object, freeing ::old_rec_buf if it is
+allocated and resetting the other members to their initial values. */
UNIV_INTERN
void
-btr_pcur_free_for_mysql(
-/*====================*/
- btr_pcur_t* cursor) /*!< in, own: persistent cursor */
+btr_pcur_reset(
+/*===========*/
+ btr_pcur_t* cursor) /*!< in, out: persistent cursor */
{
if (cursor->old_rec_buf != NULL) {
@@ -66,6 +67,7 @@ btr_pcur_free_for_mysql(
cursor->old_rec_buf = NULL;
}
+ cursor->btr_cur.index = NULL;
cursor->btr_cur.page_cur.rec = NULL;
cursor->old_rec = NULL;
cursor->old_n_fields = 0;
@@ -73,7 +75,17 @@ btr_pcur_free_for_mysql(
cursor->latch_mode = BTR_NO_LATCHES;
cursor->pos_state = BTR_PCUR_NOT_POSITIONED;
+}
+/**************************************************************//**
+Frees the memory for a persistent cursor object. */
+UNIV_INTERN
+void
+btr_pcur_free_for_mysql(
+/*====================*/
+ btr_pcur_t* cursor) /*!< in, own: persistent cursor */
+{
+ btr_pcur_reset(cursor);
mem_free(cursor);
}