chg: converting malloc calls -> calloc which zeros out the allocated memory

This commit is contained in:
iceman1001 2018-05-03 19:42:16 +02:00
commit 939b727c42
9 changed files with 55 additions and 50 deletions

View file

@ -481,7 +481,7 @@ int CmdTraceList(const char *Cmd) {
// reserv some space.
if (!trace) {
printf("trace pointer not allocated\n");
trace = malloc(USB_CMD_DATA_SIZE);
trace = calloc(USB_CMD_DATA_SIZE, sizeof(uint8_t));
}
if ( isOnline ) {
@ -571,8 +571,8 @@ int CmdTraceLoad(const char *Cmd) {
if ( trace )
free(trace);
trace = malloc(fsize);
if (trace == NULL) {
trace = calloc(fsize, sizeof(uint8_t));
if (!trace) {
PrintAndLogEx(FAILED, "Cannot allocate memory for trace");
fclose(f);
return 2;