mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
Merged revisions 77540 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r77540 | file | 2007-07-27 14:04:08 -0300 (Fri, 27 Jul 2007) | 6 lines (closes issue #10310) Reported by: prashant_jois Patches: cdr_pgsql.patch uploaded by prashant (license 114) Finish the Postgresql connection after the log messages are printed so we don't access invalid memory. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -87,9 +87,9 @@ static int pgsql_log(struct ast_cdr *cdr)
|
|||||||
connected = 1;
|
connected = 1;
|
||||||
} else {
|
} else {
|
||||||
pgerror = PQerrorMessage(conn);
|
pgerror = PQerrorMessage(conn);
|
||||||
PQfinish(conn);
|
|
||||||
ast_log(LOG_ERROR, "cdr_pgsql: Unable to connect to database server %s. Calls will not be logged!\n", pghostname);
|
ast_log(LOG_ERROR, "cdr_pgsql: Unable to connect to database server %s. Calls will not be logged!\n", pghostname);
|
||||||
ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
|
ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
|
||||||
|
PQfinish(conn);
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,9 +146,9 @@ static int pgsql_log(struct ast_cdr *cdr)
|
|||||||
connected = 1;
|
connected = 1;
|
||||||
} else {
|
} else {
|
||||||
pgerror = PQerrorMessage(conn);
|
pgerror = PQerrorMessage(conn);
|
||||||
PQfinish(conn);
|
|
||||||
ast_log(LOG_ERROR, "cdr_pgsql: Unable to reconnect to database server %s. Calls will not be logged!\n", pghostname);
|
ast_log(LOG_ERROR, "cdr_pgsql: Unable to reconnect to database server %s. Calls will not be logged!\n", pghostname);
|
||||||
ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
|
ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
|
||||||
|
PQfinish(conn);
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
connected = 0;
|
connected = 0;
|
||||||
ast_mutex_unlock(&pgsql_lock);
|
ast_mutex_unlock(&pgsql_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user