Correct potential memory leak with index list recomputation

Next plan is to use this script to make some performance measurements.
myvar=$(for i in {1..2048};do printf "%s" "#"; done; printf "\n")
cat >toast_long.sql <<EOF
CREATE TABLE aa (a int, b text);
ALTER TABLE aa ALTER COLUMN b SET STORAGE EXTERNAL;
INSERT INTO aa values (generate_series(1, 10000000), '$myvar');
DROP TABLE aa;
EOF

The same thing should be done for reads.