aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2007-09-03 11:04:22 +0000
committerdanielk1977 <danielk1977@noemail.net>2007-09-03 11:04:22 +0000
commitfa18bece7a1a530528e149e095775b13cb39bc89 (patch)
tree503111d31b34f23f3b6d24c9ae112bc954ae542d /src/main.c
parent369ff42e7713242cd14e3c135857217346454937 (diff)
downloadsqlite-fa18bece7a1a530528e149e095775b13cb39bc89.tar.gz
sqlite-fa18bece7a1a530528e149e095775b13cb39bc89.zip
Handle transient malloc() failures in sqlite3CreateFunc(). (CVS 4371)
FossilOrigin-Name: c0ce63196458c81e0859fc8a38f2dd2145a580bc
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index 803a30333..51ed40d99 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.402 2007/09/01 06:51:28 danielk1977 Exp $
+** $Id: main.c,v 1.403 2007/09/03 11:04:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -511,14 +511,16 @@ int sqlite3CreateFunc(
}
p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1);
- if( p ){
- p->flags = 0;
- p->xFunc = xFunc;
- p->xStep = xStep;
- p->xFinalize = xFinal;
- p->pUserData = pUserData;
- p->nArg = nArg;
+ assert(p || db->mallocFailed);
+ if( !p ){
+ return SQLITE_NOMEM;
}
+ p->flags = 0;
+ p->xFunc = xFunc;
+ p->xStep = xStep;
+ p->xFinalize = xFinal;
+ p->pUserData = pUserData;
+ p->nArg = nArg;
return SQLITE_OK;
}