summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-04-30 10:15:09 +0300
committerunknown <monty@narttu.mysql.fi>2003-04-30 10:15:09 +0300
commit6db41f7793d81c08f042e0b1ff23e5d387b2976f (patch)
tree4f7f621a2857e70f280e3136c841ee9f70161eff /myisam
parentb725fc0b33a29775678671b613640109a4fe8f56 (diff)
downloadmariadb-git-6db41f7793d81c08f042e0b1ff23e5d387b2976f.tar.gz
Fix reference to not initialized memory
Changed handing of priv_host to fix bug in FLUSH PRIVILEGES libmysqld/lib_sql.cc: Changed handing of priv_host to fix bug in FLUSH PRIVILEGES myisam/mi_rkey.c: Fix reference to not initialized memory sql/sql_acl.cc: Changed handing of priv_host to fix bug in FLUSH PRIVILEGES sql/sql_acl.h: Changed handing of priv_host to fix bug in FLUSH PRIVILEGES sql/sql_class.h: Changed handing of priv_host to fix bug in FLUSH PRIVILEGES sql/sql_parse.cc: Changed handing of priv_host to fix bug in FLUSH PRIVILEGES sql/unireg.h: Changed handing of priv_host to fix bug in FLUSH PRIVILEGES
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_rkey.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index 60dec0449a0..1bb478efd3d 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -93,13 +93,16 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
rw_unlock(&share->key_root_lock[inx]);
/* Calculate length of the found key; Used by mi_rnext_same */
- if ((keyinfo->flag & HA_VAR_LENGTH_KEY) && last_used_keyseg)
+ if ((keyinfo->flag & HA_VAR_LENGTH_KEY) && last_used_keyseg &&
+ info->lastpos != HA_OFFSET_ERROR)
info->last_rkey_length= _mi_keylength_part(keyinfo, info->lastkey,
last_used_keyseg);
else
info->last_rkey_length= pack_key_length;
+
+ /* Check if we don't want to have record back, only error message */
if (!buf)
- DBUG_RETURN(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
+ DBUG_RETURN(info->lastpos == HA_OFFSET_ERROR ? my_errno : 0);
if (!(*info->read_record)(info,info->lastpos,buf))
{
@@ -109,7 +112,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
info->lastpos = HA_OFFSET_ERROR; /* Didn't find key */
- /* Store key for read next */
+ /* Store last used key as a base for read next */
memcpy(info->lastkey,key_buff,pack_key_length);
info->last_rkey_length= pack_key_length;
bzero((char*) info->lastkey+pack_key_length,info->s->base.rec_reflength);