/* + * If the index list was invalidated, we better also invalidate the index + * attribute list (which should automatically invalidate other attributes + * such as primary key and replica identity) + */
+ relation->rd_indexattr = NULL; +
I think setting directly to NULL will leak the memory.