From 88ac83b4f4d71568760af3393d8fa1e9ec508857 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 17 Mar 2008 15:44:09 +0000 Subject: [PATCH] yay wasim found a bug i can actually fix right away for once git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7898 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core_db.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/switch_core_db.c b/src/switch_core_db.c index 40ca6f2bfb..094f6d98f8 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -79,12 +79,13 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s { int ret = 0; int sane = 100; + char *err = NULL; while(--sane > 0) { - ret = sqlite3_exec(db, sql, callback, data, errmsg); + ret = sqlite3_exec(db, sql, callback, data, &err); if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { if (sane > 1) { - switch_safe_free(*errmsg); + switch_safe_free(err); switch_yield(1000); continue; } @@ -93,6 +94,10 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s } } + if (err && errmsg) { + *errmsg = err; + } + return ret; }