[Asterisk-code-review] res config pgsql: Release table locks where appropriate (asterisk[14])

Sean Bright asteriskteam at digium.com
Tue Feb 28 09:44:02 CST 2017


Sean Bright has uploaded a new change for review. ( https://gerrit.asterisk.org/5105 )

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/05/5105/1

diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 2c51a53..3c91f9d 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -735,6 +735,7 @@
 	ast_mutex_lock(&pgsql_lock);
 	if (!pgsql_reconnect(database)) {
 		ast_mutex_unlock(&pgsql_lock);
+		release_table(table);
 		return -1;
 	}
 
@@ -880,6 +881,7 @@
 	ast_mutex_lock(&pgsql_lock);
 	if (!pgsql_reconnect(database)) {
 		ast_mutex_unlock(&pgsql_lock);
+		release_table(table);
 		return -1;
 	}
 
@@ -1324,6 +1326,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/5105
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>



More information about the asterisk-code-review mailing list