forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc526947
committed
Fix two violations of the ResourceOwnerEnlarge/Remember protocol.
The point of having separate ResourceOwnerEnlargeFoo andResourceOwnerRememberFoo functions is so that resource allocationcan happen in between. Doing it in some other order is just wrong.OpenTemporaryFile() did open(), enlarge, remember, which would leak theopen file if the enlarge step ran out of memory. Because fd.c has its ownlayer of resource-remembering, the consequences look like they'd be limitedto an intratransaction FD leak, but it's still not good.IncrBufferRefCount() did enlarge, remember, incr-refcount, which would blowup if the incr-refcount step ever failed. It was safe enough when written,but since the introduction of PrivateRefCountHash, I think the assumptionthat no error could happen there is pretty shaky.The odds of real problems from either bug are probably small, but still,back-patch to supported branches.Thomas Munro and Tom Lane, per a comment from Andres Freund1 parent2eb4a83 commitc526947
2 files changed
+9
-3
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3348 | 3348 |
| |
3349 | 3349 |
| |
3350 | 3350 |
| |
3351 |
| - | |
3352 | 3351 |
| |
3353 | 3352 |
| |
3354 | 3353 |
| |
| |||
3359 | 3358 |
| |
3360 | 3359 |
| |
3361 | 3360 |
| |
| 3361 | + | |
3362 | 3362 |
| |
3363 | 3363 |
| |
3364 | 3364 |
| |
|
Lines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1397 | 1397 |
| |
1398 | 1398 |
| |
1399 | 1399 |
| |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
1400 | 1407 |
| |
1401 | 1408 |
| |
1402 | 1409 |
| |
| |||
1433 | 1440 |
| |
1434 | 1441 |
| |
1435 | 1442 |
| |
1436 |
| - | |
1437 |
| - | |
1438 | 1443 |
| |
| 1444 | + | |
1439 | 1445 |
| |
1440 | 1446 |
| |
1441 | 1447 |
| |
|
0 commit comments
Comments
(0)