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

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


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5106 )

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 93126c6..2d37c6b 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -733,6 +733,7 @@
 	ast_mutex_lock(&pgsql_lock);
 	if (!pgsql_reconnect(database)) {
 		ast_mutex_unlock(&pgsql_lock);
+		release_table(table);
 		return -1;
 	}
 
@@ -878,6 +879,7 @@
 	ast_mutex_lock(&pgsql_lock);
 	if (!pgsql_reconnect(database)) {
 		ast_mutex_unlock(&pgsql_lock);
+		release_table(table);
 		return -1;
 	}
 
@@ -1322,6 +1324,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/5106
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
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