diff options
Diffstat (limited to 'src/bin/psql/tab-complete.c')
-rw-r--r-- | src/bin/psql/tab-complete.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 255061c1c41..ae8f8370f95 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3822,7 +3822,6 @@ static char ** complete_from_variables(char *text, const char *prefix, const char *suffix) { char **matches; - int overhead = strlen(prefix) + strlen(suffix) + 1; char **varnames; int nvars = 0; int maxvars = 100; @@ -3847,8 +3846,7 @@ complete_from_variables(char *text, const char *prefix, const char *suffix) } } - buffer = (char *) pg_malloc(strlen(ptr->name) + overhead); - sprintf(buffer, "%s%s%s", prefix, ptr->name, suffix); + pg_asprintf(&buffer, "%s%s%s", prefix, ptr->name, suffix); varnames[nvars++] = buffer; } |