From: Daniel Gustafsson Date: Thu, 17 Apr 2025 10:58:00 +0000 (+0200) Subject: pg_dump: Set private_date pointer to NULL in callback X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=b669293e3432ee8fdcd44854a945837bb18eea5c;p=users%2Frhaas%2Fpostgres.git pg_dump: Set private_date pointer to NULL in callback The end callback for ZStandard compression frees the private_data but didn't set the pointer to NULL after freeing. This is not a bug as the code is right now, since nothing is dereferencing the pointer upon returning from the callback but it is good practice to do. Author: Alexander Kuznetsov Reviewed-by: Daniel Gustafsson Reviewed-by: Ashutosh Bapat Reviewed-by: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/efaee52b-9550-44ca-8633-ea86076b3283@altlinux.org --- diff --git a/src/bin/pg_dump/compress_zstd.c b/src/bin/pg_dump/compress_zstd.c index 1f7b494270..cb595b10c2 100644 --- a/src/bin/pg_dump/compress_zstd.c +++ b/src/bin/pg_dump/compress_zstd.c @@ -142,6 +142,7 @@ EndCompressorZstd(ArchiveHandle *AH, CompressorState *cs) /* output buffer may be allocated in either mode */ pg_free(zstdcs->output.dst); pg_free(zstdcs); + cs->private_data = NULL; } static void