Skip to content

Commit bb69550

Browse files
author
Nikita Glukhov
committed
Fix temporary Json allocation
1 parent aa41d7d commit bb69550

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/jsonb_toaster/jsonb_toaster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,8 +2532,8 @@ jsonb_toaster_copy(Relation rel, JsonContainer *jc, char cmethod)
25322532
if (JsonContainerContainsToasted(jc))
25332533
{
25342534
//Json *js = DatumGetJson(PointerGetDatum(jb), &jsonxContainerOps, NULL);
2535-
Json jsbuf;
2536-
Json *js = JsonExpand(&jsbuf, PointerGetDatum(jb), false, &jsonxContainerOps);
2535+
char *jsbuf = alloca(JsonAllocSize(jsonxContainerOps.data_size)); /* XXX */
2536+
Json *js = JsonExpand((Json *) jsbuf, PointerGetDatum(jb), false, &jsonxContainerOps);
25372537

25382538
jsonxInit(JsonRoot(js), PointerGetDatum(jb));
25392539

@@ -2764,8 +2764,8 @@ jsonb_toaster_cmp(Relation rel, JsonContainer *new_jc, JsonContainer *old_jc, ch
27642764
#endif
27652765
{
27662766
//Json *js = DatumGetJson(PointerGetDatum(jb), &jsonxContainerOps, NULL);
2767-
Json jsbuf;
2768-
Json *js = JsonExpand(&jsbuf, PointerGetDatum(jb), false, &jsonxContainerOps);
2767+
char *jsbuf = alloca(JsonAllocSize(jsonxContainerOps.data_size)); /* XXX */
2768+
Json *js = JsonExpand((Json *) jsbuf, PointerGetDatum(jb), false, &jsonxContainerOps);
27692769

27702770
jsonxInit(JsonRoot(js), PointerGetDatum(jb));
27712771

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy