Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+4-4
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)