From 442c2157e4ebe2980801275008a5a22ec25167b5 Mon Sep 17 00:00:00 2001 From: Matthias van de Meent Date: Thu, 13 Jul 2023 13:30:08 +0200 Subject: [PATCH] Fix memory leak in g_intbig_compress If the array was stored in compressed form, we'd decompress it twice, but only deallocate one of the decompressed copies. Reported-by: Konstantin Knizhnik --- contrib/intarray/_intbig_gist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c index bfba5eef1d..062c8264e2 100644 --- a/contrib/intarray/_intbig_gist.c +++ b/contrib/intarray/_intbig_gist.c @@ -178,7 +178,7 @@ g_intbig_compress(PG_FUNCTION_ARGS) entry->rel, entry->page, entry->offset, false); - if (in != DatumGetArrayTypeP(entry->key)) + if (((Datum) in) != entry->key) pfree(in); PG_RETURN_POINTER(retval); -- 2.40.1