Fix another memory leak on malloc fail

Este commit está contenido en:
Arti Zirk 2016-12-21 02:37:15 +02:00
padre 0f5a58fa50
commit 0c1783a47c
Se han modificado 1 ficheros con 4 adiciones y 0 borrados

Ver fichero

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