mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-07 05:08:03 +02:00
makekeys: combine malloc(strlen)+strcpy into strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
This commit is contained in:
parent
78a894231a
commit
27a2e16e8e
1 changed files with 1 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue