Einar Indridason <einari(at)f-prot(dot)com> writes:
> I'm experiencing a memory leak, when I run this program.
Yup, it's a leak. See patches just committed at
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-connect.c
(note patch varies depending on branch)
regards, tom lane