forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfd602f2
committed
Clean up impenetrable logic in pg_basebackup/receivelog.c.
Coverity complained about possible double free of HandleCopyStream's"copybuf". AFAICS it's mistaken, but it is easy to see why it'sconfused, because management of that buffer is impossibly confusing.It's unreasonable that HandleEndOfCopyStream frees the buffer in somecases but not others, updates the caller's state for that in no case,and has not a single comment about how complicated that makes things.Let's put all the responsibility for freeing copybuf in the actualowner of that variable, HandleCopyStream. This results in one morePQfreemem call than before, but the logic is far easier to follow,both for humans and machines.Since this isn't (quite) actually broken, no back-patch.1 parentfcd77a6 commitfd602f2
1 file changed
+14
-7
lines changedLines changed: 14 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
803 | 803 |
| |
804 | 804 |
| |
805 | 805 |
| |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
806 | 810 |
| |
807 | 811 |
| |
808 | 812 |
| |
| |||
814 | 818 |
| |
815 | 819 |
| |
816 | 820 |
| |
817 |
| - | |
818 |
| - | |
| 821 | + | |
| 822 | + | |
819 | 823 |
| |
820 | 824 |
| |
821 | 825 |
| |
| |||
844 | 848 |
| |
845 | 849 |
| |
846 | 850 |
| |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
847 | 855 |
| |
848 | 856 |
| |
849 | 857 |
| |
| |||
920 | 928 |
| |
921 | 929 |
| |
922 | 930 |
| |
923 |
| - | |
924 |
| - | |
| 931 | + | |
| 932 | + | |
925 | 933 |
| |
926 | 934 |
| |
927 | 935 |
| |
| |||
934 | 942 |
| |
935 | 943 |
| |
936 | 944 |
| |
937 |
| - | |
938 |
| - | |
| 945 | + | |
| 946 | + | |
939 | 947 |
| |
940 | 948 |
| |
941 | 949 |
| |
| |||
1198 | 1206 |
| |
1199 | 1207 |
| |
1200 | 1208 |
| |
1201 |
| - | |
1202 | 1209 |
| |
1203 | 1210 |
| |
1204 | 1211 |
| |
|
0 commit comments
Comments
(0)