From: Peter Eisentraut Date: Tue, 29 May 2018 03:53:43 +0000 (-0400) Subject: Initialize new jsonb iterator to zero X-Git-Tag: REL_11_BETA2~105 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c9cf069454d80b0b4a54a0a90941a88a97b1122;p=postgresql 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. --- 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);