summaryrefslogtreecommitdiff
path: root/sql/sp_rcontext.cc
diff options
context:
space:
mode:
authorpem@mysql.comhem.se <>2004-01-08 10:37:31 +0100
committerpem@mysql.comhem.se <>2004-01-08 10:37:31 +0100
commitcfd97c022e1f13d38780c4e4257f7644a08f3c69 (patch)
tree4a62d68e525b14b671e42850a7847bb40a412c5b /sql/sp_rcontext.cc
parent4975595660ce132a7b81a2fa39fc83c81a25fcea (diff)
downloadmariadb-git-cfd97c022e1f13d38780c4e4257f7644a08f3c69.tar.gz
Fix BUG#2259: Crash after fetch from not-open cursor in stored procedure
Initialize and test properly when cleaning up, to avoid crash in some error cases.
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r--sql/sp_rcontext.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 41502618cda..225adc74a6b 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -176,10 +176,13 @@ sp_cursor::close(THD *thd)
void
sp_cursor::destroy()
{
- delete m_prot;
- m_prot= NULL;
- free_root(&m_mem_root, MYF(0));
- bzero((char *)&m_mem_root, sizeof(m_mem_root));
+ if (m_prot)
+ {
+ delete m_prot;
+ m_prot= NULL;
+ free_root(&m_mem_root, MYF(0));
+ bzero((char *)&m_mem_root, sizeof(m_mem_root));
+ }
m_isopen= FALSE;
}
@@ -190,14 +193,12 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
sp_pvar_t *pv;
MYSQL_ROW row;
uint fldcount;
- MYSQL_FIELD *fields= m_prot->fields;
if (! m_isopen)
{
send_error(thd, ER_SP_CURSOR_NOT_OPEN);
return -1;
}
-
if (m_current_row == NULL)
{
send_error(thd, ER_SP_FETCH_NO_DATA);