mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Fix a memory leak in JSON group-aggregates when the output is JSONB.
FossilOrigin-Name: 08e7db138b636890cb29a76d65c2069c6e2ff44470fa4bca14f4526fe5f195ae
This commit is contained in:
12
src/json.c
12
src/json.c
@@ -4905,7 +4905,11 @@ static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){
|
||||
assert( pStr->bStatic );
|
||||
}else if( flags & JSON_BLOB ){
|
||||
jsonReturnStringAsBlob(pStr);
|
||||
if( !isFinal ) pStr->nUsed--;
|
||||
if( isFinal ){
|
||||
sqlite3RCStrUnref(pStr->zBuf);
|
||||
}else{
|
||||
pStr->nUsed--;
|
||||
}
|
||||
return;
|
||||
}else if( isFinal ){
|
||||
sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
|
||||
@@ -5021,7 +5025,11 @@ static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){
|
||||
assert( pStr->bStatic );
|
||||
}else if( flags & JSON_BLOB ){
|
||||
jsonReturnStringAsBlob(pStr);
|
||||
if( !isFinal ) pStr->nUsed--;
|
||||
if( isFinal ){
|
||||
sqlite3RCStrUnref(pStr->zBuf);
|
||||
}else{
|
||||
pStr->nUsed--;
|
||||
}
|
||||
return;
|
||||
}else if( isFinal ){
|
||||
sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
|
||||
|
||||
Reference in New Issue
Block a user