Browse Source

Fix another memory leak on malloc fail

master
Arti Zirk 2 years ago
parent
commit
0c1783a47c
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      src/cli_microrl.c

+ 4
- 0
src/cli_microrl.c View File

@@ -163,6 +163,10 @@ void cli_rfid_add(const char *const *argv)
163 163
         card.uid_size = uid.size;
164 164
         memcpy(&card.uid, &uid.uidByte, uid.size);
165 165
         char *user = malloc(strlen(argv[1]) + 1);
166
+        if(!user) {
167
+            printf_P(PSTR(OUT_OF_MEMORY_MSG "\n"));
168
+            return;
169
+        }
166 170
         strcpy(user, argv[1]);
167 171
         card.user = user;
168 172
         rfid_add_card(&card);

Loading…
Cancel
Save