aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 3dea92c7d8f..71f0c8a95a8 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -594,9 +594,7 @@ StoreQueryTuple(const PGresult *result)
char *value;
/* concate prefix and column name */
- varname = pg_malloc(strlen(pset.gset_prefix) + strlen(colname) + 1);
- strcpy(varname, pset.gset_prefix);
- strcat(varname, colname);
+ pg_asprintf(&varname, "%s%s", pset.gset_prefix, colname);
if (!PQgetisnull(result, 0, i))
value = PQgetvalue(result, 0, i);
@@ -1687,10 +1685,7 @@ expand_tilde(char **filename)
{
char *newfn;
- newfn = pg_malloc(strlen(home) + strlen(p) + 1);
- strcpy(newfn, home);
- strcat(newfn, p);
-
+ pg_asprintf(&newfn, "%s%s", home, p);
free(fn);
*filename = newfn;
}