forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd24c565
committed
Tidy up GetMultiXactIdMembers()'s behavior on error
One of the error paths left *members uninitialized. That's not a livebug, because most callers don't look at *members when the functionreturns -1, but let's be tidy. One caller, in heap_lock_tuple(), does"if (members != NULL) pfree(members)", but AFAICS it never passes aninvalid 'multi' value so it should not reach that error case.The callers are also a bit inconsistent in their expectations.heap_lock_tuple() pfrees the 'members' array if it's not-NULL, otherspfree() it if "nmembers >= 0", and others if "nmembers > 0". That'snot a live bug either, because the function should never return 0, butadd an Assert for that to make it more clear. I left the callers alonefor now.I also moved the line where we set *nmembers. It wasn't wrong before,but I like to do that right next to the 'return' statement, to make itclear that it's always set on return.Also remove one unreachable return statement after ereport(ERROR), forbrevity and for consistency with the similar if-block right after it.Author: Greg Nancarrow with the additional changes by meBackpatch-through: 9.6, all supported versions1 parent3cb828d commitd24c565
1 file changed
+8
-5
lines changedLines changed: 8 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1241 | 1241 |
| |
1242 | 1242 |
| |
1243 | 1243 |
| |
| 1244 | + | |
| 1245 | + | |
1244 | 1246 |
| |
| 1247 | + | |
1245 | 1248 |
| |
1246 | 1249 |
| |
1247 | 1250 |
| |
| |||
1292 | 1295 |
| |
1293 | 1296 |
| |
1294 | 1297 |
| |
1295 |
| - | |
1296 | 1298 |
| |
1297 | 1299 |
| |
1298 | 1300 |
| |
1299 | 1301 |
| |
1300 |
| - | |
1301 |
| - | |
1302 | 1302 |
| |
1303 | 1303 |
| |
1304 | 1304 |
| |
| |||
1398 | 1398 |
| |
1399 | 1399 |
| |
1400 | 1400 |
| |
1401 |
| - | |
1402 | 1401 |
| |
1403 | 1402 |
| |
1404 | 1403 |
| |
| |||
1443 | 1442 |
| |
1444 | 1443 |
| |
1445 | 1444 |
| |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1446 | 1448 |
| |
1447 | 1449 |
| |
1448 | 1450 |
| |
1449 | 1451 |
| |
1450 | 1452 |
| |
1451 | 1453 |
| |
1452 | 1454 |
| |
| 1455 | + | |
1453 | 1456 |
| |
1454 | 1457 |
| |
1455 | 1458 |
| |
| |||
1550 | 1553 |
| |
1551 | 1554 |
| |
1552 | 1555 |
| |
1553 |
| - | |
1554 | 1556 |
| |
1555 | 1557 |
| |
1556 | 1558 |
| |
| |||
1566 | 1568 |
| |
1567 | 1569 |
| |
1568 | 1570 |
| |
| 1571 | + | |
1569 | 1572 |
| |
1570 | 1573 |
| |
1571 | 1574 |
| |
|
0 commit comments
Comments
(0)