From 6b681363772ddedc72f9a071ab4247b9e7df4692 Mon Sep 17 00:00:00 2001 From: VilhoRaatikka Date: Tue, 30 Dec 2014 13:35:59 +0200 Subject: [PATCH] Fix to bugs #664 and #665 http://bugs.skysql.com/show_bug.cgi?id=664 http://bugs.skysql.com/show_bug.cgi?id=665 Cloned session was freeing the shared 'data' dcb->data/session->data. Now only session_free for the non-clone session is allowed to free the data. --- server/core/session.c | 4 ++++ server/modules/filter/tee.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/core/session.c b/server/core/session.c index dee27e9f4..2ffc777af 100644 --- a/server/core/session.c +++ b/server/core/session.c @@ -96,6 +96,10 @@ session_alloc(SERVICE *service, DCB *client_dcb) session->ses_chk_top = CHK_NUM_SESSION; session->ses_chk_tail = CHK_NUM_SESSION; #endif + if (DCB_IS_CLONE(client_dcb)) + { + session->ses_is_child = true; + } spinlock_init(&session->ses_lock); /*< * Prevent backend threads from accessing before session is completely diff --git a/server/modules/filter/tee.c b/server/modules/filter/tee.c index f4ee04685..e11f0eb55 100644 --- a/server/modules/filter/tee.c +++ b/server/modules/filter/tee.c @@ -412,8 +412,7 @@ char *remote, *userName; goto retblock; } - - ses->ses_is_child = true; + ss_dassert(ses->ses_is_child); my_session->branch_session = ses; my_session->branch_dcb = dcb; }