summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2012-04-12 15:04:22 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2012-04-12 15:04:22 +0200
commit582b7283472a43af5d7fb51386df055ea9d44a96 (patch)
tree3a272d304a40e4f35352c9eff016ee04b0d5cc08 /sql/field_conv.cc
parentd59986d97418d588ed193d01284a21676d208f1a (diff)
downloadmariadb-git-582b7283472a43af5d7fb51386df055ea9d44a96.tar.gz
Bug#13871079 RQG_MYISAM_DML_ALTER_VALGRIND FAILS ON VALGRIND PN PB2
The class Copy_field contains a String tmp, which may allocate memory on the heap. That means that all instances of Copy_field must be properly destroyed. Alas they are not. Solution: don't use Copy_field::tmp for copying from_field => tmp => to_field in do_field_string()
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 594449174bc..605ac752e0d 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -317,10 +317,11 @@ static void do_save_blob(Copy_field *copy)
static void do_field_string(Copy_field *copy)
{
char buff[MAX_FIELD_WIDTH];
- copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset());
- copy->from_field->val_str(&copy->tmp);
- copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(),
- copy->tmp.charset());
+ String res(buff, sizeof(buff), copy->from_field->charset());
+ res.length(0U);
+
+ copy->from_field->val_str(&res);
+ copy->to_field->store(res.c_ptr_quick(), res.length(), res.charset());
}
@@ -563,7 +564,7 @@ void Copy_field::set(uchar *to,Field *from)
/*
To do:
- If 'save\ is set to true and the 'from' is a blob field, do_copy is set to
+ If 'save' is set to true and the 'from' is a blob field, do_copy is set to
do_save_blob rather than do_conv_blob. The only differences between them
appears to be: