diff options
author | unknown <kroki/tomash@moonlight.home> | 2007-01-09 12:46:35 +0300 |
---|---|---|
committer | unknown <kroki/tomash@moonlight.home> | 2007-01-09 12:46:35 +0300 |
commit | 2dab449fc72067a6e8c6e3cfd57eb66499771bd2 (patch) | |
tree | 45d21d023038bdcc6fa2358d6d950cffbd09d989 | |
parent | 0152471f5aa966b29f3df802e5b12907ee1165f1 (diff) | |
parent | 4fe1561f980c052f8bebd1c38e1fac6c3291fa7a (diff) | |
download | mariadb-git-2dab449fc72067a6e8c6e3cfd57eb66499771bd2.tar.gz |
Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-4.0
into moonlight.home:/home/tomash/src/mysql_ab/mysql-4.0-bug23443
-rw-r--r-- | heap/hp_block.c | 2 | ||||
-rw-r--r-- | heap/hp_write.c | 15 | ||||
-rw-r--r-- | sql/item_func.cc | 5 |
3 files changed, 16 insertions, 6 deletions
diff --git a/heap/hp_block.c b/heap/hp_block.c index 5c052218e58..8afcaf8d945 100644 --- a/heap/hp_block.c +++ b/heap/hp_block.c @@ -47,7 +47,7 @@ int _hp_get_new_block(HP_BLOCK *block, ulong *alloc_length) break; *alloc_length=sizeof(HP_PTRS)*i+block->records_in_block* block->recbuffer; - if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(0)))) + if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(MY_WME)))) return 1; if (i == 0) diff --git a/heap/hp_write.c b/heap/hp_write.c index 18fa95e7760..b5349d74691 100644 --- a/heap/hp_write.c +++ b/heap/hp_write.c @@ -66,13 +66,22 @@ int heap_write(HP_INFO *info, const byte *record) DBUG_RETURN(0); err: - DBUG_PRINT("info",("Duplicate key: %d",key)); + if (my_errno == HA_ERR_FOUND_DUPP_KEY) + DBUG_PRINT("info",("Duplicate key: %d",key)); info->errkey= key; - do + /* + Because 'key' is unsigned, we increase it before the loop, unless + we have to skip the key that wasn't inserted yet due to OOM. In + the loop we test 'key' before decreasing it as the protection + against value wraparound. + */ + if (my_errno != ENOMEM) + key++; + while (key-- > 0) { if (_hp_delete_key(info,share->keydef+key,record,pos,0)) break; - } while (key-- > 0); + } share->deleted++; *((byte**) pos)=share->del_link; diff --git a/sql/item_func.cc b/sql/item_func.cc index e83d1f35db8..421f72ab69b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1892,8 +1892,9 @@ bool Item_func_set_user_var::update_hash(const void *ptr, uint length, char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry)); if (entry->value == pos) entry->value=0; - if (!(entry->value=(char*) my_realloc(entry->value, length, - MYF(MY_ALLOW_ZERO_PTR)))) + entry->value= (char*) my_realloc(entry->value, length, + MYF(MY_ALLOW_ZERO_PTR | MY_WME)); + if (!entry->value) goto err; } } |