Apply suggestions from @henrygab
Check if memory allocation fails Fix memory leak Initialize struct in declaration Add/Fix some notes Remove unlikely() in favor of readability Remove a hard-coded magic number
This commit is contained in:
12 files changed
+113
-44
No files matched your search
@@ -404,6 +404,10 @@ static int CmdIndalaDemodAlt(const char *Cmd) {
|
||||
// worst case with g_GraphTraceLen=40000 is < 4096
|
||||
// under normal conditions it's < 2048
|
||||
uint8_t *data = calloc(MAX_GRAPH_TRACE_LEN, sizeof(uint8_t));
|
||||
if (data == NULL) {
|
||||
PrintAndLogEx(FAILED, "failed to allocate memory");
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
size_t datasize = getFromGraphBuf(data);
|
||||
|
||||
uint8_t rawbits[4096] = {0};
|
||||
|
||||
Reference in new issue
Block a user