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
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2138 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/hash.c b/pjlib/src/pj/hash.c
index ffebeea..fb1fdca 100644
--- a/pjlib/src/pj/hash.c
+++ b/pjlib/src/pj/hash.c
@@ -276,7 +276,7 @@
it->index = 0;
it->entry = NULL;
- for (; it->index < ht->rows; ++it->index) {
+ for (; it->index <= ht->rows; ++it->index) {
it->entry = ht->table[it->index];
if (it->entry) {
break;
@@ -294,7 +294,7 @@
return it;
}
- for (++it->index; it->index < ht->rows; ++it->index) {
+ for (++it->index; it->index <= ht->rows; ++it->index) {
it->entry = ht->table[it->index];
if (it->entry) {
break;
@@ -319,7 +319,7 @@
char line[120];
int len, totlen = 0;
- for (i=0; i<ht->rows; ++i) {
+ for (i=0; i<=ht->rows; ++i) {
unsigned count = 0;
pj_hash_entry *entry = ht->table[i];
while (entry) {