forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit61fb800
committed
Fix volatile-safety issue in pltcl_SPI_execute_plan().
The "callargs" variable is modified within PG_TRY and then referencedwithin PG_CATCH, which is exactly the coding pattern we've now foundto be unsafe. Marking "callargs" volatile would be problematic becauseit is passed by reference to some Tcl functions, so fix the problemby not modifying it within PG_TRY. We can just postpone the free()till we exit the PG_TRY construct, as is already done elsewhere in thissame file.Also, fix failure to free(callargs) when exiting on too-many-argumentserror. This is only a minor memory leak, but a leak nonetheless.In passing, remove some unnecessary "volatile" markings in the samefunction. Those doubtless are there because gcc 2.95.3 whinged aboutthem, but we now know that its algorithm for complaining is many bricksshy of a load.This is certainly a live bug with compilers that optimize similarlyto current gcc, so back-patch to all active branches.1 parent03a37e9 commit61fb800
1 file changed
+8
-7
lines changedLines changed: 8 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2165 | 2165 |
| |
2166 | 2166 |
| |
2167 | 2167 |
| |
2168 |
| - | |
2169 |
| - | |
2170 |
| - | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
2171 | 2171 |
| |
2172 | 2172 |
| |
2173 | 2173 |
| |
| |||
2297 | 2297 |
| |
2298 | 2298 |
| |
2299 | 2299 |
| |
| 2300 | + | |
| 2301 | + | |
2300 | 2302 |
| |
2301 | 2303 |
| |
2302 | 2304 |
| |
| |||
2335 | 2337 |
| |
2336 | 2338 |
| |
2337 | 2339 |
| |
2338 |
| - | |
2339 |
| - | |
2340 |
| - | |
2341 |
| - | |
2342 | 2340 |
| |
2343 | 2341 |
| |
2344 | 2342 |
| |
| |||
2365 | 2363 |
| |
2366 | 2364 |
| |
2367 | 2365 |
| |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
2368 | 2369 |
| |
2369 | 2370 |
| |
2370 | 2371 |
| |
|
0 commit comments
Comments
(0)