forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit55fe26a
committed
Fix allocation logic of cryptohash context data with OpenSSL
The allocation of the cryptohash context data when building with OpenSSLwas happening in the memory context of the caller ofpg_cryptohash_create(), which could lead to issues with resowner cleanupif cascading resources are cleaned up on an error. Like otherfacilities using resowners, move the base allocation to TopMemoryContextto ensure a correct cleanup on failure.The resulting code gets simpler with this commit as the context data isnow hold by a unique opaque pointer, so as there is only one singleallocation done in TopMemoryContext.After discussion, also change the cryptohash subroutines to return anerror if the caller provides NULL for the context data to ease errordetection on OOM.Author: Heikki LinnakangasDiscussion:https://postgr.es/m/X9xbuEoiU3dlImfa@paquier.xyz1 parent9877374 commit55fe26a
File tree
4 files changed
+81
-125
lines changed- src
- common
- include/common
- tools/pgindent
4 files changed
+81
-125
lines changedLines changed: 44 additions & 67 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
42 | 57 |
| |
43 | 58 |
| |
44 | 59 |
| |
| |||
50 | 65 |
| |
51 | 66 |
| |
52 | 67 |
| |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
53 | 74 |
| |
54 | 75 |
| |
55 | 76 |
| |
56 |
| - | |
| 77 | + | |
57 | 78 |
| |
58 | 79 |
| |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 | 80 |
| |
86 | 81 |
| |
87 | 82 |
| |
| |||
95 | 90 |
| |
96 | 91 |
| |
97 | 92 |
| |
98 |
| - | |
| 93 | + | |
99 | 94 |
| |
100 | 95 |
| |
101 | 96 |
| |
102 | 97 |
| |
103 |
| - | |
| 98 | + | |
104 | 99 |
| |
105 | 100 |
| |
106 |
| - | |
| 101 | + | |
107 | 102 |
| |
108 | 103 |
| |
109 |
| - | |
| 104 | + | |
110 | 105 |
| |
111 | 106 |
| |
112 |
| - | |
| 107 | + | |
113 | 108 |
| |
114 | 109 |
| |
115 |
| - | |
| 110 | + | |
116 | 111 |
| |
117 | 112 |
| |
118 | 113 |
| |
| |||
123 | 118 |
| |
124 | 119 |
| |
125 | 120 |
| |
126 |
| - | |
| 121 | + | |
| 122 | + | |
127 | 123 |
| |
128 | 124 |
| |
129 | 125 |
| |
130 | 126 |
| |
131 | 127 |
| |
132 |
| - | |
| 128 | + | |
133 | 129 |
| |
134 | 130 |
| |
135 | 131 |
| |
136 | 132 |
| |
137 |
| - | |
| 133 | + | |
138 | 134 |
| |
139 | 135 |
| |
140 |
| - | |
| 136 | + | |
141 | 137 |
| |
142 | 138 |
| |
143 |
| - | |
| 139 | + | |
144 | 140 |
| |
145 | 141 |
| |
146 |
| - | |
| 142 | + | |
147 | 143 |
| |
148 | 144 |
| |
149 |
| - | |
| 145 | + | |
150 | 146 |
| |
151 | 147 |
| |
152 | 148 |
| |
| |||
157 | 153 |
| |
158 | 154 |
| |
159 | 155 |
| |
160 |
| - | |
| 156 | + | |
| 157 | + | |
161 | 158 |
| |
162 | 159 |
| |
163 | 160 |
| |
164 | 161 |
| |
165 | 162 |
| |
166 |
| - | |
| 163 | + | |
167 | 164 |
| |
168 | 165 |
| |
169 | 166 |
| |
170 | 167 |
| |
171 |
| - | |
| 168 | + | |
172 | 169 |
| |
173 | 170 |
| |
174 |
| - | |
| 171 | + | |
175 | 172 |
| |
176 | 173 |
| |
177 |
| - | |
| 174 | + | |
178 | 175 |
| |
179 | 176 |
| |
180 |
| - | |
| 177 | + | |
181 | 178 |
| |
182 | 179 |
| |
183 |
| - | |
| 180 | + | |
184 | 181 |
| |
185 | 182 |
| |
186 | 183 |
| |
| |||
198 | 195 |
| |
199 | 196 |
| |
200 | 197 |
| |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 |
| - | |
214 |
| - | |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 | 198 |
| |
222 | 199 |
| |
223 | 200 |
|
0 commit comments
Comments
(0)