1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed bug in warning handling (Memory was allocated from wrong MEM_ROOT)

This commit is contained in:
monty@narttu.mysql.fi
2003-04-03 21:19:14 +03:00
parent 22075460d8
commit 4a4838059f
5 changed files with 40 additions and 27 deletions

View File

@ -44,6 +44,19 @@ This file contains the implementation of error and warnings related
#include "mysql_priv.h"
/*
Store a new message in an error object
This is used to in group_concat() to register how many warnings we actually
got after the query has been executed.
*/
void MYSQL_ERROR::set_msg(THD *thd, const char *msg_arg)
{
msg= strdup_root(&thd->warn_root, msg_arg);
}
/*
Reset all warnings for the thread
@ -91,7 +104,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
if (thd->query_id != thd->warn_id)
mysql_reset_errors(thd);
MYSQL_ERROR *err = NULL;
MYSQL_ERROR *err= NULL;
if (thd->warn_list.elements < thd->variables.max_error_count)
{
@ -101,7 +114,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
*/
MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
my_pthread_setspecific_ptr(THR_MALLOC, &thd->warn_root);
err = new MYSQL_ERROR(code, level, msg);
err= new MYSQL_ERROR(thd, code, level, msg);
if (err)
thd->warn_list.push_back(err);
my_pthread_setspecific_ptr(THR_MALLOC, old_root);