Fix memory leak on DSM slot exhaustion.

Thomas Munro <tmunro@postgresql.org>

Commit: 95936c795b9f086c2b413b5150d2993ac30354fa
Author: Thomas Munro <tmunro@postgresql.org>
Date: 2020-02-01T02:10:20Z
Releases: 9.4.26
Fix memory leak on DSM slot exhaustion.

If we attempt to create a DSM segment when no slots are available,
we should return the memory to the operating system.  Previously
we did that if the DSM_CREATE_NULL_IF_MAXSEGMENTS flag was
passed in, but we didn't do it if an error was raised.  Repair.

Back-patch to 9.4, where DSM segments arrived.

Author: Thomas Munro
Reviewed-by: Robert Haas
Reported-by: Julian Backes
Discussion: https://postgr.es/m/CA%2BhUKGKAAoEw-R4om0d2YM4eqT1eGEi6%3DQot-3ceDR-SLiWVDw%40mail.gmail.com

Files

PathChange+/−
src/backend/storage/ipc/dsm.c modified +9 −0

Discussion