Module: kamailio Branch: 5.3 Commit: 479ff8fb8761e9780bd33adf977bd44868f59b97 URL: https://github.com/kamailio/kamailio/commit/479ff8fb8761e9780bd33adf977bd448...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-05-01T09:52:25+02:00
db_redis: var initialization and safety check to avoid compiler warnings
(cherry picked from commit b9b177ccffd58b11cf460764514486d29637dd55)
---
Modified: src/modules/db_redis/redis_table.c
---
Diff: https://github.com/kamailio/kamailio/commit/479ff8fb8761e9780bd33adf977bd448... Patch: https://github.com/kamailio/kamailio/commit/479ff8fb8761e9780bd33adf977bd448...
---
diff --git a/src/modules/db_redis/redis_table.c b/src/modules/db_redis/redis_table.c index fe63490174..ed8105d807 100644 --- a/src/modules/db_redis/redis_table.c +++ b/src/modules/db_redis/redis_table.c @@ -491,7 +491,7 @@ int db_redis_parse_keys(km_redis_con_t *con) { char *start; char *end;
- str table_name; + str table_name = str_init(""); str type_name; str column_name;
@@ -539,13 +539,18 @@ int db_redis_parse_keys(km_redis_con_t *con) {
table_entry = str_hash_get(&con->tables, table_name.s, table_name.len); if (!table_entry) { - LM_ERR("No table schema found for table '%.*s', fix config by adding one to the 'schema' mod-param!\n", + LM_ERR("No table schema found for table '%.*s', fix config" + " by adding one to the 'schema' mod-param!\n", table_name.len, table_name.s); goto err; } table = table_entry->u.p; break; case DBREDIS_KEYS_TYPE_ST: + if(!table) { + LM_ERR("invalid definition, table not set\n"); + goto err; + } while(p != end && *p != ':') ++p; if (p == end) { @@ -615,8 +620,6 @@ int db_redis_parse_keys(km_redis_con_t *con) { case DBREDIS_KEYS_END_ST: LM_DBG("done parsing keys definition\n"); return 0; - - } } while (p != end);