1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Make sure SQLITE_NOMEM is reported out on a malloc failure in an ATTACH

even if the malloc failure reports within a nested calls to sqlite3_prepare(). (CVS 3164)

FossilOrigin-Name: 3538a4e30fb5131b461bb0cf72cada63e9724e14
This commit is contained in:
drh
2006-04-05 11:57:37 +00:00
parent 9d578358ee
commit 6103fe972e
4 changed files with 36 additions and 11 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.49 2006/01/24 12:09:18 danielk1977 Exp $
** $Id: attach.c,v 1.50 2006/04/05 11:57:37 drh Exp $
*/
#include "sqliteInt.h"
@@ -185,7 +185,12 @@ static void attachFunc(
}
sqlite3ResetInternalSchema(db, 0);
db->nDb = iDb;
sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile);
if( rc==SQLITE_NOMEM ){
sqlite3MallocFailed();
sqlite3_snprintf(127, zErr, "out of memory");
}else{
sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile);
}
goto attach_error;
}