diff options
author | drh <> | 2023-09-28 19:11:36 +0000 |
---|---|---|
committer | drh <> | 2023-09-28 19:11:36 +0000 |
commit | 8cdab142863a98b84baf047ce443ee37ed141ab1 (patch) | |
tree | 05c0b18535477224eb5a4ddeea273a871677828f /src | |
parent | 0a19bb078d11d2e0c4cc5183f47adabf34403b95 (diff) | |
download | sqlite-8cdab142863a98b84baf047ce443ee37ed141ab1.tar.gz sqlite-8cdab142863a98b84baf047ce443ee37ed141ab1.zip |
Fix some minor memory issues so that all legacy tests now pass.
FossilOrigin-Name: 1744bfc669346ff221f28d45fd978863e876a2d2f0b82bcf0e5ee6f0326900cc
Diffstat (limited to 'src')
-rw-r--r-- | src/json.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/json.c b/src/json.c index e43240c71..3d44489e6 100644 --- a/src/json.c +++ b/src/json.c @@ -543,10 +543,10 @@ static void jsonAppendNormalizedInt(JsonString *p, const char *zIn, u32 N){ assert( rc==2 ); jsonAppendRawNZ(p, "9.0e999", 7); } - return; + }else{ + assert( N>0 ); + jsonAppendRawNZ(p, zIn, N); } - assert( N>0 ); - jsonAppendRawNZ(p, zIn, N); sqlite3_free(zBuf); } @@ -972,6 +972,10 @@ static void jsonReturn( assert( pNode->eU==1 ); zz = sqlite3DbStrNDup(db, pNode->u.zJContent, pNode->n); + if( zz==0 ){ + sqlite3_result_error_nomem(pCtx); + return; + } z = zz; if( z[0]=='-' ){ z++; bNeg = 1; } else if( z[0]=='+' ){ z++; } |