From b436362b19477ad3a9f71bdef63906a42dbf45cb Mon Sep 17 00:00:00 2001
From: Jason Parker <jparker@digium.com>
Date: Fri, 9 Nov 2007 16:32:01 +0000
Subject: [PATCH] Fix a few potential deadlocks in cdr_sqlite3_custom. (also
 rename sample config to .sample)

Closes issue #11208, patch by Laureano.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89130 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 cdr/cdr_sqlite3_custom.c                                       | 3 +++
 ...{cdr_sqlite3_custom.conf => cdr_sqlite3_custom.conf.sample} | 0
 2 files changed, 3 insertions(+)
 rename configs/{cdr_sqlite3_custom.conf => cdr_sqlite3_custom.conf.sample} (100%)

diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c
index 26ec6ff194..a3ca00a4ec 100644
--- a/cdr/cdr_sqlite3_custom.c
+++ b/cdr/cdr_sqlite3_custom.c
@@ -94,6 +94,7 @@ static int load_config(int reload)
 
 	if (!(mappingvar = ast_variable_browse(cfg, "master"))) {
 		/* nothing configured */
+		ast_mutex_unlock(&lock);
 		ast_config_destroy(cfg);
 		return 0;
 	}
@@ -113,6 +114,7 @@ static int load_config(int reload)
 	else {
 		ast_log(LOG_WARNING, "%s: Column names not specified. Module not loaded.\n",
 				name);
+		ast_mutex_unlock(&lock);
 		ast_config_destroy(cfg);
 		return -1;
 	}
@@ -122,6 +124,7 @@ static int load_config(int reload)
 		ast_copy_string(values, tmp, sizeof(values));
 	else {
 		ast_log(LOG_WARNING, "%s: Values not specified. Module not loaded.\n", name);
+		ast_mutex_unlock(&lock);
 		ast_config_destroy(cfg);
 		return -1;
 	}
diff --git a/configs/cdr_sqlite3_custom.conf b/configs/cdr_sqlite3_custom.conf.sample
similarity index 100%
rename from configs/cdr_sqlite3_custom.conf
rename to configs/cdr_sqlite3_custom.conf.sample
-- 
GitLab