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

Ensure that OOM conditions in the generation of the "bad JSON path" error

message result in an SQLITE_NOMEM error.

FossilOrigin-Name: aa0e02b5c26a2ef3d6216a0ed8bc01382be43173485f898cb63f2a8c559f2e74
This commit is contained in:
drh
2023-12-03 20:11:35 +00:00
parent 0a18a5807a
commit a3bf077b60
3 changed files with 13 additions and 9 deletions

View File

@@ -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;
}