diff options
author | danielk1977 <danielk1977@noemail.net> | 2005-12-07 06:27:43 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2005-12-07 06:27:43 +0000 |
commit | 00fd957b789c64f143b48eaba0c33376b61db56d (patch) | |
tree | 6f79022283c7c403e51c135de31019a4583cde81 /src/vdbeapi.c | |
parent | f4208043d69f052ff8fef45252f01e5ae27656f6 (diff) | |
download | sqlite-00fd957b789c64f143b48eaba0c33376b61db56d.tar.gz sqlite-00fd957b789c64f143b48eaba0c33376b61db56d.zip |
Add some tests for malloc() failure within the column_name() and column_decl() APIs. (CVS 2805)
FossilOrigin-Name: 78f10ca0a6a02e9e8e6811489841a19e213f3afb
Diffstat (limited to 'src/vdbeapi.c')
-rw-r--r-- | src/vdbeapi.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c index bc774b4f1..5d5e9cbb9 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -58,7 +58,7 @@ sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ 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 @@ static const void *columnName( const void *(*xFunc)(Mem*), int useType ){ + const void *ret; Vdbe *p = (Vdbe *)pStmt; int n = sqlite3_column_count(pStmt); @@ -446,7 +447,13 @@ static const void *columnName( 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; } |