forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd02d4a6
committed
Avoid premature free of pass-by-reference CALL arguments.
Prematurely freeing the EState used to evaluate CALL arguments led, in somecases, to passing dangling pointers to the procedure. This was masked intrivial cases because the argument pointers would point to Const nodes inthe original expression tree, and in some other cases because the resultvalue would end up in the standalone ExprContext rather than in memorybelonging to the EState --- but that wasn't exactly high qualityprogramming either, because the standalone ExprContext was neverexplicitly freed, breaking assorted API contracts.In addition, using a separate EState for each argument was just silly.So let's use just one EState, and one ExprContext, and make the latterbelong to the former rather than be standalone, and clean up the EState(and hence the ExprContext) post-call.While at it, improve the function's commentary a bit.Discussion:https://postgr.es/m/29173.1518282748@sss.pgh.pa.us1 parent65b1d76 commitd02d4a6
File tree
3 files changed
+33
-11
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+33
-11
lines changedLines changed: 22 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2204 | 2204 |
| |
2205 | 2205 |
| |
2206 | 2206 |
| |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
2207 | 2213 |
| |
2208 | 2214 |
| |
2209 | 2215 |
| |
| |||
2218 | 2224 |
| |
2219 | 2225 |
| |
2220 | 2226 |
| |
| 2227 | + | |
| 2228 | + | |
2221 | 2229 |
| |
2222 | 2230 |
| |
| 2231 | + | |
2223 | 2232 |
| |
2224 | 2233 |
| |
2225 | 2234 |
| |
| |||
2241 | 2250 |
| |
2242 | 2251 |
| |
2243 | 2252 |
| |
2244 |
| - | |
2245 | 2253 |
| |
2246 | 2254 |
| |
2247 | 2255 |
| |
| |||
2254 | 2262 |
| |
2255 | 2263 |
| |
2256 | 2264 |
| |
| 2265 | + | |
2257 | 2266 |
| |
2258 | 2267 |
| |
2259 | 2268 |
| |
| |||
2270 | 2279 |
| |
2271 | 2280 |
| |
2272 | 2281 |
| |
| 2282 | + | |
| 2283 | + | |
2273 | 2284 |
| |
2274 | 2285 |
| |
2275 | 2286 |
| |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
2276 | 2294 |
| |
2277 | 2295 |
| |
2278 | 2296 |
| |
2279 |
| - | |
2280 | 2297 |
| |
2281 |
| - | |
2282 | 2298 |
| |
2283 | 2299 |
| |
2284 | 2300 |
| |
2285 |
| - | |
2286 | 2301 |
| |
2287 |
| - | |
| 2302 | + | |
2288 | 2303 |
| |
2289 |
| - | |
2290 | 2304 |
| |
2291 | 2305 |
| |
2292 | 2306 |
| |
| |||
2295 | 2309 |
| |
2296 | 2310 |
| |
2297 | 2311 |
| |
| 2312 | + | |
| 2313 | + | |
2298 | 2314 |
|
Lines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| 24 | + | |
| 25 | + | |
24 | 26 |
| |
25 | 27 |
| |
26 | 28 |
| |
27 | 29 |
| |
28 | 30 |
| |
29 | 31 |
| |
30 | 32 |
| |
31 |
| - | |
32 |
| - | |
33 |
| - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 |
| |
35 |
| - | |
| 38 | + | |
| 39 | + | |
36 | 40 |
| |
37 | 41 |
| |
38 | 42 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| 16 | + | |
| 17 | + | |
16 | 18 |
| |
17 | 19 |
| |
18 | 20 |
| |
19 |
| - | |
| 21 | + | |
20 | 22 |
| |
21 | 23 |
| |
22 | 24 |
| |
|
0 commit comments
Comments
(0)