• Tom Lane's avatar
    Fix memory leak in printtup.c. · f2004f19
    Tom Lane authored
    Commit f2dec34e changed things so that printtup's output stringinfo
    buffer was allocated outside the per-row temporary context, not inside
    it.  This creates a need to free that buffer explicitly when the temp
    context is freed, but that was overlooked.  In most cases, this is all
    happening inside a portal or executor context that will go away shortly
    anyhow, but that's not always true.  Notably, the stringinfo ends up
    getting leaked when JDBC uses row-at-a-time fetches.  For a query
    that returns wide rows, that adds up after awhile.
    
    Per bug #15700 from Matthias Otterbach.  Back-patch to v11 where the
    faulty code was added.
    
    Discussion: https://postgr.es/m/15700-8c408321a87d56bb@postgresql.org
    f2004f19
printtup.c 18.8 KB