Skip to content

Commit 77a436b

Browse files
committed
Fix seriously nasty memory leak in new TransactionIdIsInProgress code.
1 parent 573a71a commit 77a436b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/backend/storage/ipc/sinval.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.65 2004/07/01 00:50:52 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.66 2004/07/01 03:13:05 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -509,7 +509,6 @@ TransactionIdIsInProgress(TransactionId xid)
509509

510510
if (result)
511511
break;
512-
513512
}
514513
}
515514

@@ -531,12 +530,18 @@ TransactionIdIsInProgress(TransactionId xid)
531530
* We don't care if it aborted, because if it did, we won't find
532531
* it in the array.
533532
*/
534-
535533
for (i = 0; i < nxids; i++)
534+
{
536535
if (TransactionIdEquals(xids[i], xid))
537-
return true;
536+
{
537+
result = true;
538+
break;
539+
}
540+
}
538541
}
539542

543+
pfree(xids);
544+
540545
return result;
541546
}
542547

0 commit comments

Comments
 (0)