Fix realloc problem
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3454 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -223,7 +223,8 @@ init_words (int argc, char **argv)
|
|||||||
errx (1, "cannot allocate memory for message");
|
errx (1, "cannot allocate memory for message");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
appres.text = strdup("");
|
appres.text = malloc(128);
|
||||||
|
appres.text[0] = 0;
|
||||||
if (appres.text == NULL)
|
if (appres.text == NULL)
|
||||||
errx (1, "cannot allocate memory for message");
|
errx (1, "cannot allocate memory for message");
|
||||||
while (argv[i]) {
|
while (argv[i]) {
|
||||||
@@ -232,6 +233,7 @@ init_words (int argc, char **argv)
|
|||||||
strlen(appres.text) + n + 2);
|
strlen(appres.text) + n + 2);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
errx (1, "cannot allocate memory for message");
|
errx (1, "cannot allocate memory for message");
|
||||||
|
appres.text = tmp;
|
||||||
strcat (appres.text, argv[i]);
|
strcat (appres.text, argv[i]);
|
||||||
strcat (appres.text, " ");
|
strcat (appres.text, " ");
|
||||||
++i;
|
++i;
|
||||||
|
Reference in New Issue
Block a user