Skip to content

Commit 3f06324

Browse files
committed
Fix memory leak in pg_restore with zstd-compressed data.
EndCompressorZstd() neglected to free everything. This was most visible with a lot of large objects in the dump. Per report from Tomasz Szypowski. Back-patch to v16 where this code came in. Discussion: https://postgr.es/m/DU0PR04MB94193D038A128EF989F922D199042@DU0PR04MB9419.eurprd04.prod.outlook.com
1 parent d96d1d5 commit 3f06324

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pg_dump/compress_zstd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ EndCompressorZstd(ArchiveHandle *AH, CompressorState *cs)
137137
Assert(zstdcs->dstream == NULL);
138138
_ZstdWriteCommon(AH, cs, true);
139139
ZSTD_freeCStream(zstdcs->cstream);
140-
pg_free(zstdcs->output.dst);
141140
}
142141

142+
/* output buffer may be allocated in either mode */
143+
pg_free(zstdcs->output.dst);
143144
pg_free(zstdcs);
144145
}
145146

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