Check return value from asprintf instead of string != NULL since it

undefined behavior on Linux. From Björn Sandell


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16224 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-10-22 17:17:44 +00:00
parent af8272f96c
commit d448f74010
2 changed files with 9 additions and 6 deletions

View File

@@ -244,9 +244,10 @@ init_words (int argc, char **argv)
appres.file = argv[i];
i++;
} else {
asprintf (&appres.file,
int ret;
ret = asprintf (&appres.file,
"%s/.msgfile", getenv("HOME"));
if (appres.file == NULL)
if (ret == -1)
errx (1, "cannot allocate memory for message");
}
} else if(strcmp(argv[i], "--version") == 0) {