Skip to content

Commit 4cd4ed0

Browse files
committed
Fix case in which a debug printout would print already-pfreed data.
1 parent 8a9e329 commit 4cd4ed0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/backend/access/transam/multixact.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
3232
* Portions Copyright (c) 1994, Regents of the University of California
3333
*
34-
* $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.2 2005/05/03 19:42:40 tgl Exp $
34+
* $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.3 2005/05/07 18:14:25 tgl Exp $
3535
*
3636
*-------------------------------------------------------------------------
3737
*/
@@ -310,9 +310,9 @@ MultiXactIdExpand(MultiXactId multi, TransactionId xid)
310310
{
311311
if (TransactionIdEquals(members[i], xid))
312312
{
313-
pfree(members);
314313
debug_elog4(DEBUG2, "Expand: %u is already a member of %u",
315314
xid, multi);
315+
pfree(members);
316316
return multi;
317317
}
318318
}
@@ -376,8 +376,8 @@ MultiXactIdIsRunning(MultiXactId multi)
376376
{
377377
if (TransactionIdEquals(members[i], myXid))
378378
{
379-
pfree(members);
380379
debug_elog3(DEBUG2, "IsRunning: I (%d) am running!", i);
380+
pfree(members);
381381
return true;
382382
}
383383
}
@@ -391,14 +391,15 @@ MultiXactIdIsRunning(MultiXactId multi)
391391
{
392392
if (TransactionIdIsInProgress(members[i]))
393393
{
394-
pfree(members);
395394
debug_elog4(DEBUG2, "IsRunning: member %d (%u) is running",
396-
i, members[i]);
395+
i, members[i]);
396+
pfree(members);
397397
return true;
398398
}
399399
}
400400

401401
pfree(members);
402+
402403
debug_elog3(DEBUG2, "IsRunning: %u is not running", multi);
403404

404405
return false;
@@ -646,6 +647,7 @@ CreateMultiXactId(int nxids, TransactionId *xids)
646647

647648
/* Store the new MultiXactId in the local cache, too */
648649
mXactCachePut(multi, nxids, xids);
650+
649651
debug_elog2(DEBUG2, "Create: all done");
650652

651653
return multi;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy