summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-02-28 10:41:45 -0500
committerSean Bright <sean.bright@gmail.com>2017-02-28 09:44:09 -0600
commite5b44c26b46babd40a715b6d91aa0eaf775a0746 (patch)
tree249469084ebfcd3306eae9cf186479e3cb8d3864
parent6ebdcfe27d5a44cc7ec1840ea0295e9ad87ff2fe (diff)
res_config_pgsql: Release table locks where appropriate
The find_table() functions NULL or a locked table pointer. We are not consistently calling release_table() in failure paths. Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544
-rw-r--r--res/res_config_pgsql.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 93126c6a5..2d37c6b19 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -733,6 +733,7 @@ static int update_pgsql(const char *database, const char *tablename, const char
ast_mutex_lock(&pgsql_lock);
if (!pgsql_reconnect(database)) {
ast_mutex_unlock(&pgsql_lock);
+ release_table(table);
return -1;
}
@@ -878,6 +879,7 @@ static int update2_pgsql(const char *database, const char *tablename, const stru
ast_mutex_lock(&pgsql_lock);
if (!pgsql_reconnect(database)) {
ast_mutex_unlock(&pgsql_lock);
+ release_table(table);
return -1;
}
@@ -1322,6 +1324,7 @@ static int require_pgsql(const char *database, const char *tablename, va_list ap
if (pgsql_exec(database, tablename, ast_str_buffer(sql), &result) != 0) {
ast_mutex_unlock(&pgsql_lock);
+ release_table(table);
return -1;
}