From: Sean Bright Date: Tue, 28 Feb 2017 15:41:45 +0000 (-0500) Subject: res_config_pgsql: Release table locks where appropriate X-Git-Tag: 13.15.0-rc1~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa8f6c2fc419fdcb9ddc72f42259145d99663211;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index efb733c881..40d1a37e19 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -768,6 +768,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; } @@ -913,6 +914,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; } @@ -1357,6 +1359,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; }