Browse Source

Fix a memory leak when malloc fails on adding a new card.

lab06-card-uid-fixes
Arti Zirk 3 years ago
parent
commit
0f5a58fa50
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/rfid.c

+ 2
- 0
src/rfid.c 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;
}


Loading…
Cancel
Save