Content-Length: 254897 | pFad | http://github.com/postgrespro/postgres/commit/5bd38d2f2846c7e387d04a16c4372da0de7b1221

4B Robustify tuplesort's free_sort_tuple function · postgrespro/postgres@5bd38d2 · GitHub
Skip to content

Commit 5bd38d2

Browse files
committed
Robustify tuplesort's free_sort_tuple function
4146925 went to the trouble of removing a theoretical bug from free_sort_tuple by checking if the tuple was NULL before freeing it. Let's make this a little more robust by also setting the tuple to NULL so that should we be called again we won't end up doing a pfree on the already pfree'd tuple. Per advice from Tom Lane. Discussion: https://postgr.es/m/3188192.1626136953@sss.pgh.pa.us Backpatch-through: 9.6, same as 4146925
1 parent 4146925 commit 5bd38d2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/backend/utils/sort/tuplesort.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4777,5 +4777,6 @@ free_sort_tuple(Tuplesortstate *state, SortTuple *stup)
47774777
{
47784778
FREEMEM(state, GetMemoryChunkSpace(stup->tuple));
47794779
pfree(stup->tuple);
4780+
stup->tuple = NULL;
47804781
}
47814782
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/5bd38d2f2846c7e387d04a16c4372da0de7b1221

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy