summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-12-14 08:12:07 -0500
committerunknown <monty@mysql.com>2003-12-14 08:12:07 -0500
commitc324fddc9cbeef8d56030b3c286b77c83914ff13 (patch)
tree0f5990bf9abb2973ecd5da83d8132c2fab612787 /sql
parentafb07566181f3bca7f49f3ac5f7fc0deadccf0c7 (diff)
downloadmariadb-git-c324fddc9cbeef8d56030b3c286b77c83914ff13.tar.gz
Fixed bug in last push found by valgrind
myisam/mi_dbug.c: Added comment to warn about probabably unimportant valgrind warning sql/opt_range.cc: Fixed bug in last push (did not fill max string properly with end space) sql/sql_update.cc: Initalize not initialized variable
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_range.cc15
-rw-r--r--sql/sql_update.cc2
2 files changed, 8 insertions, 9 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 74fa237fd73..74e3f855db7 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1062,7 +1062,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (field->key_type() == HA_KEYTYPE_VARTEXT)
copies= 2;
str= str2= (char*) alloc_root(param->mem_root,
- (key_part->part_length+maybe_null)*copies);
+ (key_part->part_length+maybe_null)*copies+1);
if (!str)
DBUG_RETURN(0);
if (maybe_null)
@@ -1078,16 +1078,15 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
uint length= uint2korr(str+maybe_null);
char *end;
str2= str+ key_part->part_length + maybe_null;
- /* remove end space. The 2 is for the packed length */
- while (length > 0 && str[length+2+maybe_null-1] == ' ')
+ /* remove end space */
+ while (length > 0 && str[length+HA_KEY_BLOB_LENGTH+maybe_null-1] == ' ')
length--;
int2store(str+maybe_null, length);
/* Create key that is space filled */
- memcpy(str2, str, length+2+maybe_null);
- end= str2+ maybe_null + key_part->part_length;
- for (char *pos= str2+ 2+ length + maybe_null; pos < end ; pos++)
- *pos++= ' ';
- int2store(str2+maybe_null, key_part->part_length);
+ memcpy(str2, str, length + HA_KEY_BLOB_LENGTH + maybe_null);
+ bfill(str2+ length+ HA_KEY_BLOB_LENGTH +maybe_null,
+ key_part->part_length-length - HA_KEY_BLOB_LENGTH, ' ');
+ int2store(str2+maybe_null, key_part->part_length - HA_KEY_BLOB_LENGTH);
}
if (!(tree=new SEL_ARG(field,str,str2)))
DBUG_RETURN(0); // out of memory
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 36ceef23740..27b498d350f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -440,7 +440,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list,
:all_tables(table_list), update_tables(0), thd(thd_arg), tmp_tables(0),
updated(0), found(0), fields(field_list), values(value_list),
table_count(0), copy_field(0), handle_duplicates(handle_duplicates_arg),
- do_update(1), trans_safe(0)
+ do_update(1), trans_safe(0), transactional_tables(1)
{}