1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-18 05:01:01 +03:00

Fix double assignment.

Coverity complained about this, not without reason:

	OldMultiXactReader *state = state = pg_malloc(sizeof(*state));

(I'm surprised this is even legal C ... why is "state" in-scope
in its initialization expression?)

While at it, convert to use our newly-preferred "pg_malloc_object"
macro instead of an explicit sizeof().
This commit is contained in:
Tom Lane
2025-12-14 12:09:56 -05:00
parent 8c498479d7
commit b853e644d7

View File

@@ -119,7 +119,7 @@ OldMultiXactReader *
AllocOldMultiXactRead(char *pgdata, MultiXactId nextMulti,
MultiXactOffset32 nextOffset)
{
OldMultiXactReader *state = state = pg_malloc(sizeof(*state));
OldMultiXactReader *state = pg_malloc_object(OldMultiXactReader);
char dir[MAXPGPATH] = {0};
state->nextMXact = nextMulti;