Fix another memory leak on malloc fail
This commit is contained in:
parent
0f5a58fa50
commit
0c1783a47c
@ -163,6 +163,10 @@ void cli_rfid_add(const char *const *argv)
|
||||
card.uid_size = uid.size;
|
||||
memcpy(&card.uid, &uid.uidByte, uid.size);
|
||||
char *user = malloc(strlen(argv[1]) + 1);
|
||||
if(!user) {
|
||||
printf_P(PSTR(OUT_OF_MEMORY_MSG "\n"));
|
||||
return;
|
||||
}
|
||||
strcpy(user, argv[1]);
|
||||
card.user = user;
|
||||
rfid_add_card(&card);
|
||||
|
Loading…
Reference in New Issue
Block a user