postgres.git / summary / log / commit / refs
commit b853e644d78d99ef1779c9bf7bc3944694460aa2
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun Dec 14 17:09:56 2025 +0000
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().
src/bin/pg_upgrade/multixact_read_v18.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_upgrade/multixact_read_v18.c b/src/bin/pg_upgrade/multixact_read_v18.c
index e7496a73e0e..f74011c4786 100644
--- a/src/bin/pg_upgrade/multixact_read_v18.c
+++ b/src/bin/pg_upgrade/multixact_read_v18.c
@@ -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;
[parent: 8c498479d70f]