You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Named-bind preparation leaks Ivyresult objects on early returns #1555
Ivyreplacenamebindtoposition() and Ivyreplacenamebindtoposition2() allocate an Ivyresult through Ivyexec(), but several return paths do not release it with Ivyclear().
Affected paths in src/interfaces/libpq/ivy-exec.c include:
the PGRES_TUPLES_OK failure path in both helpers;
the successful early return when stmtHandle->namebind == NULL in Ivyreplacenamebindtoposition().
Because Ivyexec() allocates both the Ivyresult wrapper and an underlying PGresult, repeated prepares/executions on these paths leak client memory.
Expected behavior
Every non-NULL result returned by Ivyexec() should be passed to Ivyclear() before the helper returns, on both success and error paths.
Suggested fix
Add cleanup at the affected returns while preserving the existing return values and error messages. Exercise the prepare/execute paths repeatedly under a leak detector or sanitizer.
Activity
jiaoshuntian commentedon Aug 12, 2026
Thank you for reporting this.