[asterisk-commits] res config pgsql: Release table locks where appropriate (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 28 19:30:20 CST 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5104 )

Change subject: res_config_pgsql: Release table locks where appropriate
......................................................................


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
---
M res/res_config_pgsql.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, approved
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index efb733c..40d1a37 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -768,6 +768,7 @@
 	ast_mutex_lock(&pgsql_lock);
 	if (!pgsql_reconnect(database)) {
 		ast_mutex_unlock(&pgsql_lock);
+		release_table(table);
 		return -1;
 	}
 
@@ -913,6 +914,7 @@
 	ast_mutex_lock(&pgsql_lock);
 	if (!pgsql_reconnect(database)) {
 		ast_mutex_unlock(&pgsql_lock);
+		release_table(table);
 		return -1;
 	}
 
@@ -1357,6 +1359,7 @@
 
 			        if (pgsql_exec(database, tablename, ast_str_buffer(sql), &result) != 0) {
 					ast_mutex_unlock(&pgsql_lock);
+					release_table(table);
 				        return -1;
 			        }
 

-- 
To view, visit https://gerrit.asterisk.org/5104
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list