diff options
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 1ae62a4a6e8..36300e57f03 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -42,8 +42,13 @@ protected: we don't want to free and potentially have to reallocate the buffer for each call. */ - str_value.length(0); - str_value.set_charset(collation.collation); + if (!str_value.is_alloced()) + str_value.set("", 0, collation.collation); /* Avoid null ptrs */ + else + { + str_value.length(0); /* Reuse allocated area */ + str_value.set_charset(collation.collation); + } return &str_value; } public: |