Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc958d6a

Browse files
author
Nikita Glukhov
committed
Fix memleaks in json encoding using temporary memory context
1 parent9429f3f commitc958d6a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎src/backend/utils/adt/jsonb_util.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,12 +1742,29 @@ void *
17421742
JsonEncode(constJsonbValue*val,JsonValueEncoderencoder,void*cxt)
17431743
{
17441744
StringInfoDatabuffer;
1745+
#if0
1746+
MemoryContexttmpcxt,
1747+
oldcxt;
1748+
#endif
17451749

17461750
/* Allocate an output buffer. It will be enlarged as needed */
17471751
initStringInfo(&buffer);
17481752

1753+
#if0
1754+
tmpcxt=AllocSetContextCreate(CurrentMemoryContext,
1755+
"Json Encoding Context",
1756+
ALLOCSET_DEFAULT_MINSIZE,
1757+
ALLOCSET_DEFAULT_INITSIZE,
1758+
ALLOCSET_DEFAULT_MAXSIZE);
1759+
oldcxt=MemoryContextSwitchTo(tmpcxt);
1760+
#endif
1761+
17491762
(*encoder)(&buffer,val,cxt);
17501763

1764+
#if0
1765+
MemoryContextSwitchTo(oldcxt);
1766+
MemoryContextDelete(tmpcxt);
1767+
#endif
17511768
/*
17521769
* Note: the JEntry of the root is discarded. Therefore the root
17531770
* JsonbContainer struct must contain enough information to tell what kind

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp