forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2d5e0f0
committed
Fix refcounting bug in PLy_modify_tuple().
We must increment the refcount on "plntup" as soon as we have thereference, not sometime later. Otherwise, if an error is thrown inbetween, the Py_XDECREF(plntup) call in the PG_CATCH block removes arefcount we didn't add, allowing the object to be freed even thoughit's still part of the plpython function's parsetree.This appears to be the cause of crashes seen on buildfarm memberprairiedog. It's a bit surprising that we've not seen it fail repeatablybefore, considering that the regression tests have been exercising thefaulty code path since 2009.The real-world impact is probably minimal, since it's unlikely anyone wouldbe provoking the "TD["new"] is not a dictionary" error in production, andthat's the only case that is actually wrong. Still, it's a bug affectingthe regression tests, so patch all supported branches.In passing, remove dead variable "plstr", and demote "platt" to a localvariable inside the PG_TRY block, since we don't need to clean it upin the PG_CATCH path.1 parentc2a6724 commit2d5e0f0
1 file changed
+3
-5
lines changedLines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
635 | 635 |
| |
636 | 636 |
| |
637 | 637 |
| |
638 |
| - | |
639 | 638 |
| |
640 |
| - | |
641 | 639 |
| |
642 | 640 |
| |
643 | 641 |
| |
| |||
653 | 651 |
| |
654 | 652 |
| |
655 | 653 |
| |
656 |
| - | |
| 654 | + | |
657 | 655 |
| |
658 | 656 |
| |
659 | 657 |
| |
| |||
663 | 661 |
| |
664 | 662 |
| |
665 | 663 |
| |
| 664 | + | |
666 | 665 |
| |
667 | 666 |
| |
668 | 667 |
| |
669 |
| - | |
670 | 668 |
| |
671 | 669 |
| |
672 | 670 |
| |
| |||
679 | 677 |
| |
680 | 678 |
| |
681 | 679 |
| |
| 680 | + | |
682 | 681 |
| |
683 | 682 |
| |
684 | 683 |
| |
| |||
745 | 744 |
| |
746 | 745 |
| |
747 | 746 |
| |
748 |
| - | |
749 | 747 |
| |
750 | 748 |
| |
751 | 749 |
| |
|
0 commit comments
Comments
(0)