[Commits] Rev 3494: Fix memory allocation in file:///home/bell/maria/bzr/work-maria-5.5-dnames/

sanja at montyprogram.com sanja at montyprogram.com
Tue Aug 21 10:58:39 EEST 2012


At file:///home/bell/maria/bzr/work-maria-5.5-dnames/

------------------------------------------------------------
revno: 3494
revision-id: sanja at montyprogram.com-20120821075836-mb2o3dca1lly0nav
parent: sanja at montyprogram.com-20120821073006-p9qfcqz4qibo3jgo
committer: sanja at montyprogram.com
branch nick: work-maria-5.5-dnames
timestamp: Tue 2012-08-21 10:58:36 +0300
message:
  Fix memory allocation
-------------- next part --------------
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2012-08-21 07:30:06 +0000
+++ b/sql/item_cmpfunc.cc	2012-08-21 07:58:36 +0000
@@ -6051,8 +6051,7 @@ Item* Item_equal::get_first(JOIN_TAB *co
 
 longlong Item_func_dyncol_exists::val_int()
 {
-  char buff[STRING_BUFFER_USUAL_SIZE], nmstrbuf[11],
-       *alloc_buff= NULL;
+  char buff[STRING_BUFFER_USUAL_SIZE], nmstrbuf[11];
   String tmp(buff, sizeof(buff), &my_charset_bin),
          nmbuf(nmstrbuf, sizeof(nmstrbuf), system_charset_info);
   DYNAMIC_COLUMN col;
@@ -6075,21 +6074,17 @@ longlong Item_func_dyncol_exists::val_in
     {
       uint strlen;
       uint dummy_errors;
-      alloc_buff= (char *)sql_alloc((strlen= nm->length() *
+      buf.str= (char *)sql_alloc((strlen= nm->length() *
                                      my_charset_utf8_general_ci.mbmaxlen + 1));
-      if (alloc_buff)
+      if (buf.str)
       {
         buf.length=
-          copy_and_convert(alloc_buff, strlen, &my_charset_utf8_general_ci,
-                               nm->ptr(), nm->length(), nm->charset(),
-                               &dummy_errors);
-        buf.str= alloc_buff;
+          copy_and_convert(buf.str, strlen, &my_charset_utf8_general_ci,
+                           nm->ptr(), nm->length(), nm->charset(),
+                           &dummy_errors);
       }
       else
-      {
         buf.length= 0;
-        buf.str= NULL;
-      }
     }
     name= &buf;
   }
@@ -6102,8 +6097,6 @@ longlong Item_func_dyncol_exists::val_in
   rc= ((name == NULL) ?
        dynamic_column_exists(&col, (uint) num) :
        dynamic_column_exists_str(&col, name));
-  if (alloc_buff)
-    my_free(alloc_buff);
   if (rc < 0)
   {
     dynamic_column_error_message(rc);



More information about the commits mailing list