1
0
Fork 0

Compare commits

...

2 Commits

2 changed files with 6 additions and 0 deletions

View File

@ -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);

View File

@ -72,6 +72,8 @@ void rfid_add_card(const card_t *card)
new_card_user = malloc(strlen(card->user) + 1);
if (!new_card || !new_card_user) {
printf_P(PSTR(OUT_OF_MEMORY_MSG "\n"));
free(new_card_user);
free(new_card);
return;
}