diff options
author | drh <> | 2023-12-03 20:11:35 +0000 |
---|---|---|
committer | drh <> | 2023-12-03 20:11:35 +0000 |
commit | a3bf077b60d1dc08dea1014d7eb84ff57b439a05 (patch) | |
tree | 86812aaa58c4759f0de514cab4e221906f8cb5de /src/json.c | |
parent | 0a18a5807a43f44a43a84f446f82201d389886a2 (diff) | |
download | sqlite-a3bf077b60d1dc08dea1014d7eb84ff57b439a05.tar.gz sqlite-a3bf077b60d1dc08dea1014d7eb84ff57b439a05.zip |
Ensure that OOM conditions in the generation of the "bad JSON path" error
message result in an SQLITE_NOMEM error.
FossilOrigin-Name: aa0e02b5c26a2ef3d6216a0ed8bc01382be43173485f898cb63f2a8c559f2e74
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c index 9d29685eb..9fcfd3e10 100644 --- a/src/json.c +++ b/src/json.c @@ -2667,8 +2667,12 @@ static char *jsonBadPathError( ){ char *zMsg = sqlite3_mprintf("bad JSON path: %Q", zPath); if( ctx==0 ) return zMsg; - sqlite3_result_error(ctx, zMsg, -1); - sqlite3_free(zMsg); + if( zMsg ){ + sqlite3_result_error(ctx, zMsg, -1); + sqlite3_free(zMsg); + }else{ + sqlite3_result_error_nomem(ctx); + } return 0; } |