Commit 30c66e7
committed
Fix SPI error cleanup and memory leak
Since the SPI stack has been moved from TopTransactionContext to
TopMemoryContext, setting _SPI_stack to NULL in AtEOXact_SPI() leaks
memory. In fact, we don't need to do that anymore: We just leave the
allocated stack around for the next SPI use.
Also, refactor the SPI cleanup so that it is run both at transaction end
and when returning to the main loop on an exception. The latter is
necessary when a procedure calls a COMMIT or ROLLBACK command that
itself causes an error.1 parent a365f52 commit 30c66e7
File tree
3 files changed
+19
-14
lines changed- src
- backend
- executor
- tcop
- include/executor
3 files changed
+19
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
263 | 277 | | |
264 | 278 | | |
265 | 279 | | |
266 | 280 | | |
267 | 281 | | |
268 | 282 | | |
269 | | - | |
270 | | - | |
271 | | - | |
| 283 | + | |
272 | 284 | | |
273 | 285 | | |
274 | 286 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | 287 | | |
281 | 288 | | |
282 | 289 | | |
283 | 290 | | |
284 | 291 | | |
285 | 292 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 293 | + | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
3941 | 3942 | | |
3942 | 3943 | | |
3943 | 3944 | | |
| 3945 | + | |
3944 | 3946 | | |
3945 | 3947 | | |
3946 | 3948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
0 commit comments