I noticed that \bind is leaking memory for each option.
=# SELECT $1, $2, $3 \ bind 1 2 3 \g
The leaked memory blocks are comming from psql_scan_slash_option(). The attached small patch resolves that issue. I looked through the function's call sites, but I didn't find the same mistake.