* st.c (st_foreach): don't access ptr->hash after func call.
It may access freed area. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8d532a8689
commit
8fd5bf0758
@ -1,3 +1,8 @@
|
|||||||
|
Mon Feb 15 22:45:26 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* st.c (st_foreach): don't access ptr->hash after func call.
|
||||||
|
It may access freed area.
|
||||||
|
|
||||||
Mon Feb 15 22:25:16 2010 Tanaka Akira <akr@fsij.org>
|
Mon Feb 15 22:25:16 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/zlib/zlib.c (zlib_mem_alloc): suppress valgrind warnings.
|
* ext/zlib/zlib.c (zlib_mem_alloc): suppress valgrind warnings.
|
||||||
|
2
st.c
2
st.c
@ -774,10 +774,10 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
|
|||||||
|
|
||||||
if ((ptr = table->head) != 0) {
|
if ((ptr = table->head) != 0) {
|
||||||
do {
|
do {
|
||||||
|
i = ptr->hash % table->num_bins;
|
||||||
retval = (*func)(ptr->key, ptr->record, arg);
|
retval = (*func)(ptr->key, ptr->record, arg);
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case ST_CHECK: /* check if hash is modified during iteration */
|
case ST_CHECK: /* check if hash is modified during iteration */
|
||||||
i = ptr->hash % table->num_bins;
|
|
||||||
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
|
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
/* call func with error notice */
|
/* call func with error notice */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user