diff options
author | Michael Paquier | 2023-02-22 05:22:13 +0000 |
---|---|---|
committer | Michael Paquier | 2023-02-22 05:22:13 +0000 |
commit | 8bf5af2ee6ea82a79817692de94347086da96b43 (patch) | |
tree | 25052640a7da196a1142563f18867be1f390e574 | |
parent | 1a943d03d60e6a45036c77ca31d02ebd6e3ee169 (diff) |
Fix small memory leak in psql's \bind command
psql_scan_slash_option() returns a malloc()'d result through a
PQExpBuffer, and exec_command_bind() was doing an extra allocation of
this option for no effect.
Introduced in 5b66de3.
Author: Kyotaro Horiguchi
Reviewed-by: Corey Huinker
Discussion: https://postgr.es/m/[email protected]
-rw-r--r-- | src/bin/psql/command.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index b5201edf55..955397ee9d 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -480,7 +480,7 @@ exec_command_bind(PsqlScanState scan_state, bool active_branch) nalloc = nalloc ? nalloc * 2 : 1; pset.bind_params = pg_realloc_array(pset.bind_params, char *, nalloc); } - pset.bind_params[nparams - 1] = pg_strdup(opt); + pset.bind_params[nparams - 1] = opt; } pset.bind_nparams = nparams; |