Skip to content

Commit

Permalink
db_redis: var initialization and safety check to avoid compiler warnings
Browse files Browse the repository at this point in the history
(cherry picked from commit b9b177c)
  • Loading branch information
miconda committed May 1, 2020
1 parent 5b44b60 commit 479ff8f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/modules/db_redis/redis_table.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 479ff8f

Please sign in to comment.