Module: kamailio
Branch: master
Commit: 3ca9765eea980283963a48a9767e93566063057f
URL:
https://github.com/kamailio/kamailio/commit/3ca9765eea980283963a48a9767e935…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-12-26T09:59:44+01:00
db_redis: use safe clist iteration for db_redis_free_tables()
---
Modified: src/modules/db_redis/redis_table.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3ca9765eea980283963a48a9767e935…
Patch:
https://github.com/kamailio/kamailio/commit/3ca9765eea980283963a48a9767e935…
---
diff --git a/src/modules/db_redis/redis_table.c b/src/modules/db_redis/redis_table.c
index e9db44458e..fe63490174 100644
--- a/src/modules/db_redis/redis_table.c
+++ b/src/modules/db_redis/redis_table.c
@@ -294,7 +294,9 @@ void db_redis_free_tables(km_redis_con_t *con) {
struct str_hash_table *ht;
struct str_hash_table *col_ht;
struct str_hash_entry *he;
+ struct str_hash_entry *he_b;
struct str_hash_entry *col_he;
+ struct str_hash_entry *col_he_b;
struct str_hash_entry *last;
struct str_hash_entry *col_last;
redis_table_t *table;
@@ -305,13 +307,13 @@ void db_redis_free_tables(km_redis_con_t *con) {
ht = &con->tables;
for (i = 0; i < ht->size; ++i) {
last = (&ht->table[i])->prev;
- clist_foreach(&ht->table[i], he, next) {
+ clist_foreach_safe(&ht->table[i], he, he_b, next) {
table = (redis_table_t*) he->u.p;
col_ht = &table->columns;
for (j = 0; j < col_ht->size; ++j) {
col_last = (&col_ht->table[j])->prev;
- clist_foreach(&col_ht->table[j], col_he, next) {
+ clist_foreach_safe(&col_ht->table[j], col_he, col_he_b, next) {
pkg_free(col_he->key.s);
if (col_he == col_last) {
pkg_free(col_he);