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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user