From 3c9cf069454d80b0b4a54a0a90941a88a97b1122 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 28 May 2018 23:53:43 -0400 Subject: [PATCH] Initialize new jsonb iterator to zero Use palloc0() instead of palloc() to create a new JsonbIterator. Otherwise, the isScalar field is sometimes not initialized. There is probably no impact in practice, but it's cleaner this way and it avoids future problems. --- src/backend/utils/adt/jsonb_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c index 2524584d95..3be900f8ee 100644 --- a/src/backend/utils/adt/jsonb_util.c +++ b/src/backend/utils/adt/jsonb_util.c @@ -901,7 +901,7 @@ iteratorFromContainer(JsonbContainer *container, JsonbIterator *parent) { JsonbIterator *it; - it = palloc(sizeof(JsonbIterator)); + it = palloc0(sizeof(JsonbIterator)); it->container = container; it->parent = parent; it->nElems = JsonContainerSize(container); -- 2.40.0