From b5132f6fdfeebe9c817469cfa33bf00aa22bc14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Groenvall?= Date: Tue, 9 Sep 1997 12:11:16 +0000 Subject: [PATCH] Fix realloc problem git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3454 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/xnlock/xnlock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appl/xnlock/xnlock.c b/appl/xnlock/xnlock.c index 7911028f5..58a835418 100644 --- a/appl/xnlock/xnlock.c +++ b/appl/xnlock/xnlock.c @@ -223,7 +223,8 @@ init_words (int argc, char **argv) errx (1, "cannot allocate memory for message"); } } else { - appres.text = strdup(""); + appres.text = malloc(128); + appres.text[0] = 0; if (appres.text == NULL) errx (1, "cannot allocate memory for message"); while (argv[i]) { @@ -232,6 +233,7 @@ init_words (int argc, char **argv) strlen(appres.text) + n + 2); if (tmp == NULL) errx (1, "cannot allocate memory for message"); + appres.text = tmp; strcat (appres.text, argv[i]); strcat (appres.text, " "); ++i;