CHG: 'mem load' - adapted loading files to use new load function.

loading binary file can be called with NULL pointer,  don't forget to free it.
This commit is contained in:
Chris 2018-11-12 22:55:19 +01:00
commit 25b07682dc
2 changed files with 27 additions and 45 deletions

View file

@ -184,7 +184,11 @@ int loadFile(const char *preferredName, const char *suffix, void* data, size_t*
goto out;
}
memcpy(data, dump, bytes_read);
if ( (data) == NULL) {
(data) = calloc( bytes_read, sizeof(uint8_t));
}
memcpy( (data), dump, bytes_read);
free(dump);
PrintAndLogDevice(SUCCESS, "loaded %d bytes from binary file %s", bytes_read, fileName);