summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-01-14 20:51:05 +0400
committerAlexander Barkov <bar@mariadb.com>2019-01-14 20:51:05 +0400
commit29f77d41f531a94d1a71d6e5d33f2be104e99026 (patch)
treed65701efd4f89818be010d5fb3d1e7867311c543 /sql/sql_string.cc
parentaad0165ceab4fa4e756f5fd473ef9df003a447cb (diff)
downloadmariadb-git-29f77d41f531a94d1a71d6e5d33f2be104e99026.tar.gz
MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
Bug was introduced in this commit: commit: a9ca819897f5c82582bfd3fedb09c78131cf8e00 Call alloc() instead of realloc() Use alloc() if we don't need original string (avoid copy) Removed not needed test of str_length in sql_string.cc copy_if_not_alloced() was forgotten when changing realloc()'s to alloc()'s. Changing it now.
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r--sql/sql_string.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index b84585114b7..45af08f8966 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -941,7 +941,7 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
(void) from->realloc(from_length);
return from;
}
- if (to->realloc(from_length))
+ if (to->alloc(from_length))
return from; // Actually an error
if ((to->str_length=MY_MIN(from->str_length,from_length)))
memcpy(to->Ptr,from->Ptr,to->str_length);