diff options
author | V Narayanan <v.narayanan@sun.com> | 2009-07-17 13:10:22 +0530 |
---|---|---|
committer | V Narayanan <v.narayanan@sun.com> | 2009-07-17 13:10:22 +0530 |
commit | 55588472262a43421568d92752f80911b6f4f40a (patch) | |
tree | f552e0f7b2f4f831704c113e98667b9677e6bae5 | |
parent | 1a4bc9a1e429697f86f63f2599e49a4f2d29cd32 (diff) | |
parent | 5a0a258ec6c308cf5667d0b1ef7ecde8afecae94 (diff) | |
download | mariadb-git-55588472262a43421568d92752f80911b6f4f40a.tar.gz |
merging with mysql-5.0-bugteam
-rw-r--r-- | mysys/array.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mysys/array.c b/mysys/array.c index 4ea1946d837..354508f05ef 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -31,10 +31,10 @@ DESCRIPTION init_dynamic_array() initiates array and allocate space for init_alloc eilements. - Array is usable even if space allocation failed. + Array is usable even if space allocation failed, hence, the + function never returns TRUE. RETURN VALUE - TRUE my_malloc_ci() failed FALSE Ok */ @@ -56,11 +56,12 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, array->max_element=init_alloc; array->alloc_increment=alloc_increment; array->size_of_element=element_size; - if (!(array->buffer=(char*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME)))) - { + /* + Since the dynamic array is usable even if allocation fails here malloc + should not throw an error + */ + if (!(array->buffer= (char*) my_malloc_ci(element_size*init_alloc, MYF(0)))) array->max_element=0; - DBUG_RETURN(TRUE); - } DBUG_RETURN(FALSE); } |