Re: BUG #19438: segfault with temp_file_limit inside cursor
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: kuzmin.db4@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2026-03-29T16:25:38Z
Lists: pgsql-bugs
I wrote: > ... I don't think alignedalloc.c > needs its own defense either: it can rely on the underlying > context type. I started to wonder if an explicit test in AlignedAllocFree could be useful anyway to make such problems a bit less obscure. However, when I tried p = palloc_aligned(...); pfree(p); pfree(p); I got ERROR: pfree called with invalid pointer 0x1f286b0 (header 0x7f7f7f7f7f7f7f7f) That is, we'll never get to AlignedAllocFree because the underlying context would have wipe_mem'd the aligned chunk's header during the first pfree. The only case in which such a test could be helpful is in a build with MEMORY_CONTEXT_CHECKING but not CLOBBER_FREED_MEMORY. While I suppose some people might build that way, it's got to be such a tiny minority as to not be worth worrying about. regards, tom lane
Commits
-
Be more careful to preserve consistency of a tuplestore.
- 739477345036 19 (unreleased) landed
- adb7873bb933 18.4 landed
- 811f3263a48d 15.18 landed
- 7cd23aad2a7a 14.23 landed
- 59c139d53be3 16.14 landed
- 1f5b6a5e5d74 17.10 landed
-
Detect pfree or repalloc of a previously-freed memory chunk.
- a26ac902f662 16.14 landed
- 3f3eefc28892 18.4 landed
- 0c8b4e9cfc45 17.10 landed
- 095555daf124 19 (unreleased) landed
-
Improve performance of and reduce overheads of memory management
- c6e0fe1f2a08 16.0 cited