mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix minor glitches in the json1.c extension, mostly having to do with OOM
behavior. FossilOrigin-Name: cc5204149c4053b9e529a72102d8df0925ad1ea1
This commit is contained in:
@ -703,10 +703,11 @@ static int jsonParse(
|
||||
const char *zJson /* Input JSON text to be parsed */
|
||||
){
|
||||
int i;
|
||||
if( zJson==0 ) return 1;
|
||||
memset(pParse, 0, sizeof(*pParse));
|
||||
if( zJson==0 ) return 1;
|
||||
pParse->zJson = zJson;
|
||||
i = jsonParseValue(pParse, 0);
|
||||
if( pParse->oom ) i = -1;
|
||||
if( i>0 ){
|
||||
while( isspace(zJson[i]) ) i++;
|
||||
if( zJson[i] ) i = -1;
|
||||
@ -753,7 +754,10 @@ static int jsonParseFindParents(JsonParse *pParse){
|
||||
u32 *aUp;
|
||||
assert( pParse->aUp==0 );
|
||||
aUp = pParse->aUp = sqlite3_malloc( sizeof(u32)*pParse->nNode );
|
||||
if( aUp==0 ) return SQLITE_NOMEM;
|
||||
if( aUp==0 ){
|
||||
pParse->oom = 1;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
jsonParseFillInParentage(pParse, 0, 0);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@ -1672,8 +1676,8 @@ static int jsonEachFilter(
|
||||
p->eType = pNode->eType;
|
||||
if( p->eType>=JSON_ARRAY ){
|
||||
pNode->u.iKey = 0;
|
||||
p->iEnd = p->i + pNode->n + 1;
|
||||
if( !p->bRecursive ) p->i++;
|
||||
p->iEnd = p->i + pNode->n;
|
||||
}else{
|
||||
p->iEnd = p->i+1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user