Hi, My collegue Konstantin (cc-ed) noticed that the GiST code of intarray may leak memory in certain index operations:
> g_intbig_compress(...): > [...] > ArrayType *in = DatumGetArrayTypeP(entry->key); > [...] > if (in != DatumGetArrayTypeP(entry->key)) > pfree(in); DatumGetArrayTypeP will allocate a new, uncompressed copy if the given Datum is compressed. So in this code, if entry->key is compressed we'd allocate two decompressed copies, while only we only deallocate the first of these two. I believe the attached patch fixes the issue. It looks like this bug has existed since the code was first committed, so backpatching would go back to 11 if this is an active issue. Kind regards, Matthias van de Meent
0001-Fix-memory-leak-in-g_intbig_compress.patch
Description: Binary data