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.
pull/32/head
Peter Eisentraut 7 years ago
parent 01deec5f8a
commit 3c9cf06945
  1. 2
      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);

Loading…
Cancel
Save