[Asterisk-code-review] res config sqlite3: Fix crash when loading with invalid config (asterisk[14])

Joshua Colp asteriskteam at digium.com
Sun Feb 19 12:45:23 CST 2017


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

Change subject: res_config_sqlite3: Fix crash when loading with invalid config
......................................................................


res_config_sqlite3: Fix crash when loading with invalid config

When ast_config_load() fails with CONFIG_STATUS_FILEINVALID, it has
already destroyed the ast_config struct for us. Trying to do it again
results in a crash.

Change-Id: If6a5c0ca718ad428e01a1fb25beb209a9ac18bc6
---
M res/res_config_sqlite3.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/res/res_config_sqlite3.c b/res/res_config_sqlite3.c
index a306123..be8da73 100644
--- a/res/res_config_sqlite3.c
+++ b/res/res_config_sqlite3.c
@@ -1127,6 +1127,8 @@
 	if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEINVALID) {
 		ast_log(LOG_ERROR, "%s config file '%s'\n",
 			config == CONFIG_STATUS_FILEMISSING ? "Missing" : "Invalid", config_filename);
+		ast_mutex_unlock(&config_lock);
+		return 0;
 	} else {
 		const char *cat;
 		struct realtime_sqlite3_db *db;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6a5c0ca718ad428e01a1fb25beb209a9ac18bc6
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list