Add some tests for malloc() failure within the column_name() and column_decl() APIs. (CVS 2805)

FossilOrigin-Name: 78f10ca0a6a02e9e8e6811489841a19e213f3afb
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index bc774b4..5d5e9cb 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -58,7 +58,7 @@
   return sqlite3VdbeIntValue((Mem*)pVal);
 }
 const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
-  return (const char *)sqlite3ValueText(pVal, SQLITE_UTF8);
+  return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
 }
 #ifndef SQLITE_OMIT_UTF16
 const void *sqlite3_value_text16(sqlite3_value* pVal){
@@ -439,6 +439,7 @@
   const void *(*xFunc)(Mem*),
   int useType
 ){
+  const void *ret;
   Vdbe *p = (Vdbe *)pStmt;
   int n = sqlite3_column_count(pStmt);
 
@@ -446,7 +447,13 @@
     return 0;
   }
   N += useType*n;
-  return xFunc(&p->aColName[N]);
+  ret = xFunc(&p->aColName[N]);
+
+  /* A malloc may have failed inside of the xFunc() call. If this is the case,
+  ** clear the mallocFailed flag and return NULL.
+  */
+  sqlite3ClearMallocFailed();
+  return ret;
 }