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

Make sure the sqlite3_create_collation() interfaces always return an error

code if they fail.  Ticket [a04e42a3fcacaffa3133436].

FossilOrigin-Name: 6464276ec1c0951a6edc59eb402ca3dd49629a18
This commit is contained in:
drh
2010-10-11 17:58:21 +00:00
parent 4e49c77f88
commit 88404c2a7d
3 changed files with 16 additions and 17 deletions

View File

@@ -1602,13 +1602,12 @@ static int createCollation(
}
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);
if( pColl ){
pColl->xCmp = xCompare;
pColl->pUser = pCtx;
pColl->xDel = xDel;
pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED));
pColl->type = collType;
}
if( pColl==0 ) return SQLITE_NOMEM;
pColl->xCmp = xCompare;
pColl->pUser = pCtx;
pColl->xDel = xDel;
pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED));
pColl->type = collType;
sqlite3Error(db, SQLITE_OK, 0);
return SQLITE_OK;
}