Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8bf5af2

Browse filesBrowse files
committed
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/20230221.115555.89096938631423206.horikyota.ntt@gmail.com
1 parent 1a943d0 commit 8bf5af2
Copy full SHA for 8bf5af2

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

‎src/bin/psql/command.c

Copy file name to clipboardExpand all lines: src/bin/psql/command.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ exec_command_bind(PsqlScanState scan_state, bool active_branch)
480480
nalloc = nalloc ? nalloc * 2 : 1;
481481
pset.bind_params = pg_realloc_array(pset.bind_params, char *, nalloc);
482482
}
483-
pset.bind_params[nparams - 1] = pg_strdup(opt);
483+
pset.bind_params[nparams - 1] = opt;
484484
}
485485

486486
pset.bind_nparams = nparams;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.