summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-22 12:49:06 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-22 12:49:06 +0100
commit9fefe973360124f281122a129434a36e661168b9 (patch)
treed4028e2d680914e2a0c233fc4ea287ba0cbaeba0 /sql/field.cc
parent8fcdd6b0ecbb966f4479856efe93a963a7a422f7 (diff)
parentc8f0eeb9c8596be83fefb7fef9f9871e53edb020 (diff)
downloadmariadb-git-9fefe973360124f281122a129434a36e661168b9.tar.gz
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 878e3d305af..716d522a196 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1157,12 +1157,15 @@ void Field_num::prepend_zeros(String *value)
int diff;
if ((diff= (int) (field_length - value->length())) > 0)
{
- bmove_upp((uchar*) value->ptr()+field_length,
- (uchar*) value->ptr()+value->length(),
- value->length());
- bfill((uchar*) value->ptr(),diff,'0');
- value->length(field_length);
- (void) value->c_ptr_quick(); // Avoid warnings in purify
+ const bool error= value->realloc(field_length);
+ if (!error)
+ {
+ bmove_upp((uchar*) value->ptr()+field_length,
+ (uchar*) value->ptr()+value->length(),
+ value->length());
+ bfill((uchar*) value->ptr(),diff,'0');
+ value->length(field_length);
+ }
}
}