From b86d9f2b969fe44121f7f58929120b1dfa2a84b2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 28 Apr 2020 22:36:57 +0200 Subject: [PATCH] cppcheck fix --- common/crapto1/crypto1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/crapto1/crypto1.c b/common/crapto1/crypto1.c index dd5541b29..82203ef5e 100644 --- a/common/crapto1/crypto1.c +++ b/common/crapto1/crypto1.c @@ -18,7 +18,6 @@ Copyright (C) 2008-2008 bla */ #include - #include "crapto1.h" #include "parity.h" @@ -34,7 +33,6 @@ void crypto1_init(struct Crypto1State *state, uint64_t key) { state->odd = state->odd << 1 | BIT(key, (i - 1) ^ 7); state->even = state->even << 1 | BIT(key, i ^ 7); } - return; } void crypto1_deinit(struct Crypto1State *state) { @@ -42,9 +40,9 @@ void crypto1_deinit(struct Crypto1State *state) { state->even = 0; } -#if !defined(__arm__) || defined(__linux__) || defined(_WIN32) || defined(__APPLE__) // bare metal ARM Proxmark lacks malloc()/free() +#if !defined(__arm__) || defined(__linux__) || defined(_WIN32) || defined(__APPLE__) // bare metal ARM Proxmark lacks calloc()/free() struct Crypto1State *crypto1_create(uint64_t key) { - struct Crypto1State *state = malloc(sizeof(*state)); + struct Crypto1State *state = calloc(sizeof(*state), sizeof(uint8_t)); if (!state) return NULL; crypto1_init(state, key); return state;