diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-11-13 14:44:46 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-11-13 14:46:06 -0500 |
| commit | 797ea5219ca1ddb54c9f9a5e908a1b2935a628f6 (patch) | |
| tree | 31eee8b70523a3e9085f30b8b72d0120c0795db8 /src/include/pg_config_manual.h | |
| parent | 759340c8f52416cfcd934a25f52894359a5ebed7 (diff) | |
Fix memory leaks in record_out() and record_send().
record_out() leaks memory: it fails to free the strings returned by the
per-column output functions, and also is careless about detoasted values.
This results in a query-lifespan memory leakage when returning composite
values to the client, because printtup() runs the output functions in the
query-lifespan memory context. Fix it to handle these issues the same way
printtup() does. Also fix a similar leakage in record_send().
(At some point we might want to try to run output functions in
shorter-lived memory contexts, so that we don't need a zero-leakage policy
for them. But that would be a significantly more invasive patch, which
doesn't seem like material for back-patching.)
In passing, use appendStringInfoCharMacro instead of appendStringInfoChar
in the innermost data-copying loop of record_out, to try to shave a few
cycles from this function's runtime.
Per trouble report from Carlos Henrique Reimer. Back-patch to all
supported versions.
Diffstat (limited to 'src/include/pg_config_manual.h')
0 files changed, 0 insertions, 0 deletions
