[asterisk-commits] bbryant: trunk r304600 - /trunk/res/res_config_pgsql.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 27 14:09:38 CST 2011


Author: bbryant
Date: Thu Jan 27 14:09:33 2011
New Revision: 304600

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=304600
Log:
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


Modified:
    trunk/res/res_config_pgsql.c

Modified: trunk/res/res_config_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_config_pgsql.c?view=diff&rev=304600&r1=304599&r2=304600
==============================================================================
--- trunk/res/res_config_pgsql.c (original)
+++ trunk/res/res_config_pgsql.c Thu Jan 27 14:09:33 2011
@@ -265,6 +265,10 @@
 			AST_LIST_UNLOCK(&psql_tables);
 			return table;
 		}
+	}
+
+	if (database == NULL) {
+		return NULL;
 	}
 
 	ast_debug(1, "Table '%s' not found in cache, querying now\n", orig_tablename);
@@ -1514,7 +1518,7 @@
 		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");




More information about the asterisk-commits mailing list