makekeys: combine malloc(strlen)+strcpy into strdup

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
This commit is contained in:
Alan Coopersmith 2009-03-17 18:38:58 -07:00
parent 78a894231a
commit 27a2e16e8e

View file

@ -100,12 +100,11 @@ main(int argc, char *argv[])
key);
continue;
}
name = malloc((unsigned)strlen(key)+1);
name = strdup(key);
if (!name) {
fprintf(stderr, "makekeys: out of memory!\n");
exit(1);
}
(void)strcpy(name, key);
info[ksnum].name = name;
ksnum++;
if (ksnum == KTNUM) {