diff options
author | bbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-27 20:09:33 +0000 |
---|---|---|
committer | bbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-27 20:09:33 +0000 |
commit | 763292a6619c8bd445c67f7cc107632517d44426 (patch) | |
tree | cd6af9a1da7e628c2c3e295308015ab062bf32be /res | |
parent | c2f34c05c06ee1a103684860f1a31e1c5596c139 (diff) |
Patch that fixes the "realtime show pgsql cache" command crash when giving a
table name, because of the use of an uninitialized variable. Fixes an error
introduced in r300882.
(closes issue #18605)
Reported by: romain_proformatique
Patches:
res_config_pgsql_fix.patch uploaded by romain proformatique (license 975)
Tested by: romain_proformatique
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@304600 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_config_pgsql.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 82fa25e49..caafb52df 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -267,6 +267,10 @@ static struct tables *find_table(const char *database, const char *orig_tablenam } } + if (database == NULL) { + return NULL; + } + ast_debug(1, "Table '%s' not found in cache, querying now\n", orig_tablename); /* Not found, scan the table */ @@ -1514,7 +1518,7 @@ static char *handle_cli_realtime_pgsql_cache(struct ast_cli_entry *e, int cmd, s AST_LIST_UNLOCK(&psql_tables); } else if (a->argc == 5) { /* List of columns */ - if ((cur = find_table(cur->name, a->argv[4]))) { + if ((cur = find_table(NULL, a->argv[4]))) { struct columns *col; ast_cli(a->fd, "Columns for Table Cache '%s':\n", a->argv[4]); ast_cli(a->fd, "%-20.20s %-20.20s %-3.3s %-8.8s\n", "Name", "Type", "Len", "Nullable"); |