summaryrefslogtreecommitdiff
path: root/choose.c
diff options
context:
space:
mode:
Diffstat (limited to 'choose.c')
-rw-r--r--choose.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/choose.c b/choose.c
index c2a0c34..b8cc946 100644
--- a/choose.c
+++ b/choose.c
@@ -145,6 +145,7 @@ GetSessionNames(int *count_ret, String **short_names_ret,
{
char *host = ((char *) strchr (id, '/')) + 1;
char *colon = (char *) strrchr (host, ':');
+ char *lockmsg;
/* backtrack over previous colon if there are 2 (DECnet),
but not three (IPv6) */
@@ -153,11 +154,8 @@ GetSessionNames(int *count_ret, String **short_names_ret,
*colon = '\0';
- (*long_names_ret)[*count_ret] =
- XtMalloc (strlen (name) + strlen (host) + 14);
-
- sprintf ((*long_names_ret)[*count_ret],
- "%s (locked at %s)", name, host);
+ XtAsprintf (&lockmsg, "%s (locked at %s)", name, host);
+ (*long_names_ret)[*count_ret] = lockmsg;
*colon = ':';
XtFree (id);