Skip to content

Commit 2edd41b

Browse files
committed
Fix dangling pointer access
1 parent cd292bd commit 2edd41b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/mmts/pglogical_apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ process_remote_commit(StringInfo in)
662662
case PGLOGICAL_PREPARE:
663663
{
664664
Assert(IsTransactionState() && TransactionIdIsValid(MtmGetCurrentTransactionId()));
665-
gid = pq_getmsgstring(in);
665+
gid = pstrdup(pq_getmsgstring(in)); /* in case of spilling large transaction to the file, message body will be deallocated, so copy it */
666666
if (MtmExchangeGlobalTransactionStatus(gid, TRANSACTION_STATUS_IN_PROGRESS) == TRANSACTION_STATUS_ABORTED) {
667667
MTM_LOG1("Avoid prepare of previously aborted global transaction %s", gid);
668668
AbortCurrentTransaction();

0 commit comments

Comments
 (0)