Commit 24a02757 authored by unknown's avatar unknown
Browse files

Fixed memory reference errors found by valgrind


sql/ha_federated.cc:
  Change mode to -rw-rw-r--
myisam/mi_create.c:
  Ensure that all referenced memory is reset
mysql-test/r/type_timestamp.result:
  More tests
mysql-test/t/func_compress.test:
  Added comment
mysql-test/t/type_timestamp.test:
  More tests
sql/field.h:
  Count number of varchars in table
sql/item_cmpfunc.cc:
  Safety fix (to avoid warning from valgrind)
sql/opt_range.cc:
  Simple optimzation
sql/sql_acl.cc:
  Safety fix (to avoid warning from valgrind)
sql/sql_parse.cc:
  Safety fix for prepared statements
sql/sql_show.cc:
  Move variable declarations first in function
  Remove hidden variable (it)
  Remove accessing freed memory (table_list->table_name)
sql/sql_update.cc:
  Compare records with varchars correctly
sql/table.cc:
  Safety fix when running with purify/valgrind
  Fix wrong memory reference in case of errors
sql/table.h:
  Added counting of varchar fields
strings/ctype-mb.c:
  Fill max_str properly
parent 0b7895b9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -630,10 +630,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
    {
      HA_KEYSEG sseg;
      sseg.type=SPTYPE;
      sseg.language= 7;
      sseg.language= 7;                         /* Binary */
      sseg.null_bit=0;
      sseg.bit_start=0;
      sseg.bit_end=0;
      sseg.bit_length= 0;
      sseg.bit_pos= 0;
      sseg.length=SPLEN;
      sseg.null_pos=0;
      sseg.start=j*SPLEN;
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@ UPDATE t1 SET value="my value" WHERE id="myKey";
SELECT stamp FROM t1 WHERE id="myKey";
stamp
1999-04-02 00:00:00
UPDATE t1 SET id="myKey" WHERE value="my value";
SELECT stamp FROM t1 WHERE id="myKey";
stamp
1999-04-02 00:00:00
drop table t1;
create table t1 (a timestamp);
insert into t1 values (now());
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
#
# Test for compress and uncompress functions:
#
# Note that this test gives error in the gzip library when running under
# valgrind, but these warnings can be ignored

select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
select length(@test_compress_string);
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00");
SELECT stamp FROM t1 WHERE id="myKey";
UPDATE t1 SET value="my value" WHERE id="myKey";
SELECT stamp FROM t1 WHERE id="myKey";
UPDATE t1 SET id="myKey" WHERE value="my value";
SELECT stamp FROM t1 WHERE id="myKey";
drop table t1;

create table t1 (a timestamp);
+8 −2
Original line number Diff line number Diff line
@@ -952,14 +952,20 @@ class Field_varstring :public Field_str {
    :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
	       unireg_check_arg, field_name_arg, table_arg, cs),
    length_bytes(length_bytes_arg)
  {}
  {
    if (table)
      table->s->varchar_fields++;
  }
  Field_varstring(uint32 len_arg,bool maybe_null_arg,
		  const char *field_name_arg,
		  struct st_table *table_arg, CHARSET_INFO *cs)
    :Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
	       NONE, field_name_arg, table_arg, cs),
    length_bytes(len_arg < 256 ? 1 :2)
  {}
  {
    if (table)
      table->s->varchar_fields++;
  }

  enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
  enum ha_base_keytype key_type() const;
Loading