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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy