Fix accesses to uninitialized memory (found by valgrind)

mysys/my_alloc.c:
  Added comment for free_root
sql/filesort.cc:
  Removed valgrind warning
sql/sql_select.cc:
  Remove not needed my_casedn_str() for internal files
  (Old code actually didn't do any god as it was accessing not used memory)
sql/sql_view.cc:
  Removed access to uninitialized memory
sql/table.cc:
  Cleanup of error handling
This commit is contained in:
unknown 2005-01-13 03:02:49 +02:00
commit 90b9065dce
5 changed files with 71 additions and 54 deletions

View file

@ -948,11 +948,12 @@ frm_type_enum mysql_frm_type(char *path)
{
DBUG_RETURN(FRMTYPE_ERROR);
}
length= my_read(file, (byte*) header, 10, MYF(MY_WME));
length= my_read(file, (byte*) header, sizeof(header), MYF(MY_WME));
my_close(file, MYF(MY_WME));
if (length == (int) MY_FILE_ERROR)
DBUG_RETURN(FRMTYPE_ERROR);
if (!strncmp(header, "TYPE=VIEW\n", 10))
if (length < (int) sizeof(header) ||
!strncmp(header, "TYPE=VIEW\n", sizeof(header)))
DBUG_RETURN(FRMTYPE_VIEW);
DBUG_RETURN(FRMTYPE_TABLE); // Is probably a .frm table
}