1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Add tests and fixes for OOM handling in sqlite3changeset_concat().

FossilOrigin-Name: df0b2d21dcd81679e55b24866f97568019932983
This commit is contained in:
dan
2011-04-15 16:03:32 +00:00
parent f29123b572
commit 1756ae10e1
6 changed files with 86 additions and 30 deletions

View File

@ -2786,6 +2786,7 @@ static int sessionChangeMerge(
nByte = sizeof(SessionChange) + pExist->nRecord + nRec;
pNew = (SessionChange *)sqlite3_malloc(nByte);
if( !pNew ){
sqlite3_free(pExist);
return SQLITE_NOMEM;
}
memset(pNew, 0, sizeof(SessionChange));
@ -2886,7 +2887,10 @@ int sessionConcatChangeset(
pTab->zName = (char *)zNew;
}
if( sessionGrowHash(pTab) ) break;
if( sessionGrowHash(pTab) ){
rc = SQLITE_NOMEM;
break;
}
iHash = sessionChangeHash(pTab, aRec, pTab->nChange);
/* Search for existing entry. If found, remove it from the hash table.