[svn-commits] tilghman: trunk r88007 - /trunk/cdr/cdr_adaptive_odbc.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 1 00:44:41 CDT 2007


Author: tilghman
Date: Thu Nov  1 00:44:40 2007
New Revision: 88007

URL: http://svn.digium.com/view/asterisk?view=rev&rev=88007
Log:
Fix memory leak
Reported by: eliel
Fixed by: tilghman
Closes issue #11136

Modified:
    trunk/cdr/cdr_adaptive_odbc.c

Modified: trunk/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_adaptive_odbc.c?view=diff&rev=88007&r1=88006&r2=88007
==============================================================================
--- trunk/cdr/cdr_adaptive_odbc.c (original)
+++ trunk/cdr/cdr_adaptive_odbc.c Thu Nov  1 00:44:40 2007
@@ -314,8 +314,18 @@
 	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;
 	}
 




More information about the svn-commits mailing list