Commit 20171079 authored by unknown's avatar unknown
Browse files

Fixed some issues found by valgrind

(one testcase, one memory leak and some accesses to not initialized memory)


mysql-test/r/events_scheduling.result:
  Changed event timer to two seconds to not get problems with slow system or when running with valgrind
mysql-test/t/events_scheduling.test:
  Changed event timer to two seconds to not get problems with slow system or when running with valgrind
mysql-test/valgrind.supp:
  Avoid purify warnings from DBUG library (safe to do)
sql/ha_berkeley.cc:
  Fix problem with not freed memory
sql/sql_class.cc:
  Ensure that row_count is initalized (as we otherwise may access it uninitialized)
sql/sql_show.cc:
  c_ptr -> ptr to avoid accessing not initialized memory
sql/sql_yacc.yy:
  Fix to not access not initialized memory
sql/table.cc:
  Fix to not access not initialized memory
sql/time.cc:
  Fix to not access not initialized memory
parent 6c3babe5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ CREATE TABLE table_3(a int);
CREATE TABLE table_4(a int);
CREATE TABLE T19170(s1 TIMESTAMP);
SET GLOBAL event_scheduler=1;
CREATE EVENT E19170 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP);
CREATE EVENT E19170 ON SCHEDULE EVERY 2 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP);
CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1);
CREATE EVENT start_n_end
ON SCHEDULE EVERY 1 SECOND
+3 −1
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ CREATE TABLE table_3(a int);
CREATE TABLE table_4(a int);
CREATE TABLE T19170(s1 TIMESTAMP);
SET GLOBAL event_scheduler=1;
CREATE EVENT E19170 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP);
# We need to have 2 to make it safe with valgrind. This is probably because
# of when we calculate the timestamp value
CREATE EVENT E19170 ON SCHEDULE EVERY 2 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP);
CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1);
CREATE EVENT start_n_end
  ON SCHEDULE EVERY 1 SECOND
+13 −0
Original line number Diff line number Diff line
@@ -420,3 +420,16 @@
   fun:fprintf
   fun:print_stacktrace
}

#
# Safe warnings, that may happen because of thread scheduling
#

{
   dbug initialization
   Memcheck:Leak
   fun:malloc
   fun:DbugMalloc
   fun:ListAdd
   fun:_db_set_
}
+5 −0
Original line number Diff line number Diff line
@@ -361,6 +361,7 @@ static bool berkeley_show_logs(THD *thd, stat_print_fn *stat_print)
  init_sql_alloc(&show_logs_root, BDB_LOG_ALLOC_BLOCK_SIZE,
		 BDB_LOG_ALLOC_BLOCK_SIZE);
  *root_ptr= &show_logs_root;
  all_logs= free_logs= 0;

  if ((error= db_env->log_archive(db_env, &all_logs,
				  DB_ARCH_ABS | DB_ARCH_LOG)) ||
@@ -395,6 +396,10 @@ static bool berkeley_show_logs(THD *thd, stat_print_fn *stat_print)
    }
  }
err:
  if (all_logs)
    free(all_logs);
  if (free_logs)
    free(free_logs);
  free_root(&show_logs_root,MYF(0));
  *root_ptr= old_mem_root;
  DBUG_RETURN(error);
+1 −1
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ THD::THD()
  hash_clear(&handler_tables_hash);
  tmp_table=0;
  used_tables=0;
  cuted_fields= sent_row_count= 0L;
  cuted_fields= sent_row_count= row_count= 0L;
  limit_found_rows= 0;
  statement_id_counter= 0UL;
#ifdef ERROR_INJECT_SUPPORT
Loading