cppcheck nullPointerOutOfMemory

This commit is contained in:
Philippe Teuwen committed 2025-03-24 23:46:43 +01:00
1 parent e42932738e
commit ad84875afd
44 files changed
+314 -5

No files matched your search

+6 -1
View File
@@ -1678,7 +1678,12 @@ static int CmdLFHitagEload(const char *Cmd) {
// check dump len..
if (bytes_read == HITAG2_MAX_BYTE_SIZE || bytes_read == 4 * 64) {
lf_hitag_t *payload = calloc(1, sizeof(lf_hitag_t) + bytes_read);
lf_hitag_t *payload = calloc(1, sizeof(lf_hitag_t) + bytes_read);
if (payload == NULL) {
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
free(dump);
return PM3_EMALLOC;
}
if (use_ht1)
payload->type = 1;