diff options
author | unknown <monty@narttu.mysql.fi> | 2003-06-24 12:10:35 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-06-24 12:10:35 +0300 |
commit | fff1f663c2d55faa57aaeae29df11515772c1b0b (patch) | |
tree | 415b1821c33eac5fc78fcb02664dfd546daa9406 /myisam/mi_preload.c | |
parent | 01450dbb79540c01e6b0381ce0760418dcdfc133 (diff) | |
download | mariadb-git-fff1f663c2d55faa57aaeae29df11515772c1b0b.tar.gz |
Fixed some new memory leaks
Updated VC++ files
VC++Files/client/mysql.dsp:
Update of VC++ files
VC++Files/client/mysqlclient.dsp:
Update of VC++ files
VC++Files/libmysqld/examples/test_libmysqld.dsp:
Update of VC++ files
VC++Files/libmysqld/libmysqld.def:
Update of VC++ files
VC++Files/libmysqld/libmysqld.dsp:
Update of VC++ files
VC++Files/myisam/myisam.dsp:
Update of VC++ files
VC++Files/mysql.dsw:
Update of VC++ files
VC++Files/sql/mysqld.dsp:
Update of VC++ files
include/mysql.h:
Add missing client functions to embedded server
libmysql/libmysql.def:
sort functions to enable comparison with libmysqld.def
libmysqld/libmysqld.c:
Add missing client functions to embedded server
libmysqld/libmysqld.def:
sort functions to enable comparison with libmysql.def
Added missing functions
myisam/mi_preload.c:
Fixed compiler warning.
Small code cleanup
scripts/make_win_src_distribution.sh:
Fixed typo
Don't run zip in verbose mode
scripts/mysql_create_system_tables.sh:
Change so that localhost has full access (to make this like 4.0)
scripts/mysql_fix_privilege_tables.sh:
Allow on to run this from the source distribution
sql-common/client.c:
Fixed memory leak
sql/item_sum.cc:
Removed compiler warning
sql/slave.cc:
Cleanup
sql/sql_client.cc:
Portability fix
sql/sql_help.cc:
Fixed memory leak
Diffstat (limited to 'myisam/mi_preload.c')
-rw-r--r-- | myisam/mi_preload.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/myisam/mi_preload.c b/myisam/mi_preload.c index be45be66ecf..a5d9bec160e 100644 --- a/myisam/mi_preload.c +++ b/myisam/mi_preload.c @@ -42,35 +42,32 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) { uint i; - uint length; - uint block_length= 0; + ulong length, block_length= 0; uchar *buff= NULL; MYISAM_SHARE* share= info->s; uint keys= share->state.header.keys; MI_KEYDEF *keyinfo= share->keyinfo; my_off_t key_file_length= share->state.state.key_file_length; my_off_t pos= share->base.keystart; + DBUG_ENTER("mi_preload"); if (!keys || !key_map || key_file_length == pos) - return 0; + DBUG_RETURN(0); block_length= keyinfo[0].block_length; - if (!key_map) - return 0; - /* Check whether all indexes use the same block size */ for (i= 1 ; i < keys ; i++) { if (keyinfo[i].block_length != block_length) - return (my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE); + DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE); } length= info->preload_buff_size/block_length * block_length; set_if_bigger(length, block_length); if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME)))) - return (my_errno= HA_ERR_OUT_OF_MEM); + DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM); if (flush_key_blocks(share->kfile, FLUSH_RELEASE)) goto err; @@ -78,7 +75,8 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) do { /* Read the next block of index file into the preload buffer */ - set_if_smaller(length, key_file_length-pos); + if ((my_off_t) length > (key_file_length-pos)) + length= (ulong) (key_file_length-pos); if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE))) goto err; @@ -103,16 +101,14 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) goto err; pos+= length; } - } while (pos != key_file_length); my_free(buff, MYF(0)); - - return 0; + DBUG_RETURN(0); err: my_free(buff, MYF(MY_ALLOW_ZERO_PTR)); - return (my_errno= errno); + DBUG_RETURN(my_errno= errno); } |