aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordrh <>2023-07-26 11:53:14 +0000
committerdrh <>2023-07-26 11:53:14 +0000
commit2b5719706647a6831e2d5fadd56d04f67fc63837 (patch)
tree414a98535955853af5a72132dbed745faf48005d /src/json.c
parent7725370ff42e5be18aa97e480e9b8379167da692 (diff)
downloadsqlite-2b5719706647a6831e2d5fadd56d04f67fc63837.tar.gz
sqlite-2b5719706647a6831e2d5fadd56d04f67fc63837.zip
More comment improvements in json.c. Do not run jsonLookup() following
an OOM error. FossilOrigin-Name: cd5fda8c2e354da7458b7c1a82ff18c5946f8dab16095bb0293bec57f6804f17
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/json.c b/src/json.c
index 8fe3116bc..5deeb6acb 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1841,9 +1841,10 @@ static int jsonParseFindParents(JsonParse *pParse){
#define JSON_CACHE_SZ 4 /* Max number of cache entries */
/*
-** Obtain a complete parse of the JSON found in the first argument
-** of the argv array. Use the sqlite3_get_auxdata() cache for this
-** parse if it is available. If the cache is not available or if it
+** Obtain a complete parse of the JSON found in the pJson argument
+**
+** Use the sqlite3_get_auxdata() cache to find a preexisting parse
+** if it is available. If the cache is not available or if it
** is no longer valid, parse the JSON again and return the new parse.
** Also register the new parse so that it will be available for
** future sqlite3_get_auxdata() calls.
@@ -2003,7 +2004,9 @@ static JsonNode *jsonLookupStep(
){
u32 i, j, nKey;
const char *zKey;
- JsonNode *pRoot = &pParse->aNode[iRoot];
+ JsonNode *pRoot;
+ if( pParse->oom ) return 0;
+ pRoot = &pParse->aNode[iRoot];
while( (pRoot->jnFlags & JNODE_REPLACE)!=0 && pParse->useMod ){
u32 idx = (u32)(pRoot - pParse->aNode);
i = pParse->iSubst;