Re: Memory error in src/backend/replication/logical/origin.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Dilger <hornschnorter(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory error in src/backend/replication/logical/origin.c
Date: 2017-11-26 18:28:18
Message-ID: 18632.1511720898@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Dilger <hornschnorter(at)gmail(dot)com> writes:
> bool nulls[Natts_pg_replication_origin];
> memset(&nulls, 0, sizeof(nulls));

> around lines 277 through 303. Patch below.

AFAIK this is not a bug, though I agree that dropping the "&" is probably
better style. The reason is that applying "&" to an undecorated array
name is basically a no-op, because without "&" the array name would decay
to a pointer anyway. With "&", the address-taking is explicit, but you
still get a pointer to the array, not a pointer to some pointer to the
array. Ain't C fun?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-11-26 20:05:27 Re: [HACKERS] More stats about skipped vacuums
Previous Message Mark Dilger 2017-11-26 18:07:24 Memory error in src/backend/replication/logical/origin.c