1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Fix a memory leak following a syntax error in jsonb().

FossilOrigin-Name: bf4b36eda8e200b67041ebdf60fc31d0325bd84185272f8d390c56a91d6ac1ee
This commit is contained in:
drh
2023-10-05 15:05:33 +00:00
parent 9061e22a05
commit 01acfd5805
3 changed files with 11 additions and 10 deletions

View File

@@ -4203,12 +4203,13 @@ static void jsonbFunc(
x.nJson = nJson;
if( jsonConvertTextToBlob(pParse, ctx) ){
sqlite3_result_error(ctx, "malformed JSON", -1);
sqlite3_free(pParse->aBlob);
}else{
sqlite3_result_blob(ctx, pParse->aBlob, pParse->nBlob, sqlite3_free);
pParse->aBlob = 0;
pParse->nBlob = 0;
pParse->nBlobAlloc = 0;
}
pParse->aBlob = 0;
pParse->nBlob = 0;
pParse->nBlobAlloc = 0;
jsonParseReset(pParse);
}
}