diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-01 05:44:40 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-01 05:44:40 +0000 |
commit | 8380627624844335a7d4359916942ae15e6bcf5a (patch) | |
tree | 4d89d1d6ec6012f3418de40d6ad9eae7423ca407 /cdr/cdr_adaptive_odbc.c | |
parent | 1150e1ce8c9d459504ca551bf854725f677168f3 (diff) |
Fix memory leak
Reported by: eliel
Fixed by: tilghman
Closes issue #11136
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@88007 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_adaptive_odbc.c')
-rw-r--r-- | cdr/cdr_adaptive_odbc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index 66f704d68..129ae1682 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -314,8 +314,18 @@ static int odbc_log(struct ast_cdr *cdr) SQLHSTMT stmt = NULL; SQLLEN rows = 0; + if (!sql || !sql2) { + if (sql) + ast_free(sql); + if (sql2) + ast_free(sql2); + return -1; + } + if (AST_RWLIST_RDLOCK(&odbc_tables)) { ast_log(LOG_ERROR, "Unable to lock table list. Insert CDR(s) failed.\n"); + ast_free(sql); + ast_free(sql2); return -1; } |