Changeset 2138 for pjproject


Ignore:
Timestamp:
Jul 14, 2008 4:58:11 PM (16 years ago)
Author:
bennylp
Message:

Ticket #568: The hash table ignores the last row of the table in hash table iteration, causing some memory leaks during shutdown routine because some objects are not destroyed

Location:
pjproject/trunk/pjlib
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/build/Makefile

    r2037 r2138  
    3434export TEST_SRCDIR = ../src/pjlib-test 
    3535export TEST_OBJS += activesock.o atomic.o echo_clt.o errno.o exception.o \ 
    36                     fifobuf.o file.o ioq_perf.o ioq_udp.o ioq_unreg.o \ 
    37                     ioq_tcp.o \ 
     36                    fifobuf.o file.o hash_test.o ioq_perf.o ioq_udp.o \ 
     37                    ioq_unreg.o ioq_tcp.o \ 
    3838                    list.o mutex.o os.o pool.o pool_perf.o rand.o rbtree.o \ 
    3939                    select.o sleep.o sock.o sock_perf.o \ 
  • pjproject/trunk/pjlib/src/pj/hash.c

    r2039 r2138  
    277277    it->entry = NULL; 
    278278 
    279     for (; it->index < ht->rows; ++it->index) { 
     279    for (; it->index <= ht->rows; ++it->index) { 
    280280        it->entry = ht->table[it->index]; 
    281281        if (it->entry) { 
     
    295295    } 
    296296 
    297     for (++it->index; it->index < ht->rows; ++it->index) { 
     297    for (++it->index; it->index <= ht->rows; ++it->index) { 
    298298        it->entry = ht->table[it->index]; 
    299299        if (it->entry) { 
     
    320320    int len, totlen = 0; 
    321321 
    322     for (i=0; i<ht->rows; ++i) { 
     322    for (i=0; i<=ht->rows; ++i) { 
    323323        unsigned count = 0;     
    324324        pj_hash_entry *entry = ht->table[i]; 
  • pjproject/trunk/pjlib/src/pjlib-test/test.c

    r2039 r2138  
    103103#endif 
    104104 
     105#if INCLUDE_HASH_TEST 
     106    DO_TEST( hash_test() ); 
     107#endif 
     108 
    105109#if INCLUDE_TIMESTAMP_TEST 
    106110    DO_TEST( timestamp_test() ); 
  • pjproject/trunk/pjlib/src/pjlib-test/test.h

    r2039 r2138  
    3737#define INCLUDE_RAND_TEST           GROUP_LIBC 
    3838#define INCLUDE_LIST_TEST           GROUP_DATA_STRUCTURE 
     39#define INCLUDE_HASH_TEST           GROUP_DATA_STRUCTURE 
    3940#define INCLUDE_POOL_TEST           GROUP_LIBC 
    4041#define INCLUDE_POOL_PERF_TEST      GROUP_LIBC 
     
    7576extern int rand_test(void); 
    7677extern int list_test(void); 
     78extern int hash_test(void); 
    7779extern int pool_test(void); 
    7880extern int pool_perf_test(void); 
Note: See TracChangeset for help on using the changeset viewer.