diff options
author | drh <> | 2023-10-05 15:05:33 +0000 |
---|---|---|
committer | drh <> | 2023-10-05 15:05:33 +0000 |
commit | 01acfd5805349741a81b0c8666364f3795915753 (patch) | |
tree | 39c4aeabd36706807d0869056756a9de857bb353 /src/json.c | |
parent | 9061e22a05f7b0037a9121a8f58f26e37ae8c2f0 (diff) | |
download | sqlite-01acfd5805349741a81b0c8666364f3795915753.tar.gz sqlite-01acfd5805349741a81b0c8666364f3795915753.zip |
Fix a memory leak following a syntax error in jsonb().
FossilOrigin-Name: bf4b36eda8e200b67041ebdf60fc31d0325bd84185272f8d390c56a91d6ac1ee
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/json.c b/src/json.c index 3307db0ba..24487f430 100644 --- a/src/json.c +++ b/src/json.c @@ -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); } } |