From 8380627624844335a7d4359916942ae15e6bcf5a Mon Sep 17 00:00:00 2001 From: tilghman Date: Thu, 1 Nov 2007 05:44:40 +0000 Subject: 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 --- cdr/cdr_adaptive_odbc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cdr/cdr_adaptive_odbc.c') 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; } -- cgit v1.2.3