[svn-commits] tilghman: branch 1.6.2 r267670 - in /branches/1.6.2: ./ funcs/func_odbc.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 3 14:51:11 CDT 2010


Author: tilghman
Date: Thu Jun  3 14:51:06 2010
New Revision: 267670

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=267670
Log:
Merged revisions 267669 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r267669 | tilghman | 2010-06-03 14:46:42 -0500 (Thu, 03 Jun 2010) | 8 lines
  
  Handle OOM errors more gracefully.
  
  (closes issue #17084)
   Reported by: falves11
   Patches: 
         issue17084_162_A.diff uploaded by falves11 (license 374)
   Tested by: falves11
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/funcs/func_odbc.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/funcs/func_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/funcs/func_odbc.c?view=diff&rev=267670&r1=267669&r2=267670
==============================================================================
--- branches/1.6.2/funcs/func_odbc.c (original)
+++ branches/1.6.2/funcs/func_odbc.c Thu Jun  3 14:51:06 2010
@@ -219,7 +219,7 @@
 	struct ast_str *insertbuf = ast_str_thread_get(&sql2_buf, 16);
 	const char *status = "FAILURE";
 
-	if (!buf) {
+	if (!buf || !insertbuf) {
 		return -1;
 	}
 
@@ -396,7 +396,7 @@
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
 	const char *status = "FAILURE";
 
-	if (!sql) {
+	if (!sql || !colnames) {
 		pbx_builtin_setvar_helper(chan, "ODBCSTATUS", status);
 		return -1;
 	}
@@ -538,6 +538,21 @@
 			int i;
 			struct ast_str *coldata = ast_str_thread_get(&coldata_buf, 16);
 			char *ptrcoldata;
+
+			if (!coldata) {
+				ast_free(resultset);
+				SQLCloseCursor(stmt);
+				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+				ast_odbc_release_obj(obj);
+				obj = NULL;
+				pbx_builtin_setvar_helper(chan, "ODBCSTATUS", "MEMERROR");
+				if (chan)
+					ast_autoservice_stop(chan);
+				if (bogus_chan) {
+					ast_channel_free(chan);
+				}
+				return -1;
+			}
 
 			if (y == 0) {
 				char colname[256];
@@ -1083,6 +1098,11 @@
 		char colname[256];
 		SQLULEN maxcol;
 
+		if (!coldata) {
+			AST_RWLIST_UNLOCK(&queries);
+			return CLI_SUCCESS;
+		}
+
 		for (dsn = 0; dsn < 5; dsn++) {
 			if (ast_strlen_zero(query->readhandle[dsn])) {
 				continue;




More information about the svn-commits mailing list